diff --git a/catalog/Red_River_MPI-ESM-LR_future/collection.json b/catalog/Red_River_MPI-ESM-LR_future/collection.json index 9efdaea1335943be5167b10186ec4954615467b9..32fa32881ed3d6f6d0716a53c6bbd9f8e6d51a55 100644 --- a/catalog/Red_River_MPI-ESM-LR_future/collection.json +++ b/catalog/Red_River_MPI-ESM-LR_future/collection.json @@ -37,7 +37,7 @@ 269.95 ], "step": 0.1, - "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"ProjectedCRS\",\"name\":\"unknown\",\"base_crs\":{\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"unknown\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}},\"conversion\":{\"name\":\"unknown\",\"method\":{\"name\":\"Equidistant Cylindrical\",\"id\":{\"authority\":\"EPSG\",\"code\":1028}},\"parameters\":[{\"name\":\"Latitude of 1st standard parallel\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8823}},{\"name\":\"Latitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8801}},{\"name\":\"Longitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8802}},{\"name\":\"False easting\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8806}},{\"name\":\"False northing\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8807}}]},\"coordinate_system\":{\"subtype\":\"Cartesian\",\"axis\":[{\"name\":\"Easting\",\"abbreviation\":\"E\",\"direction\":\"east\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Northing\",\"abbreviation\":\"N\",\"direction\":\"north\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}}" + "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"GeographicCRS\",\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"Unknown based on WGS 84 ellipsoid\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563,\"id\":{\"authority\":\"EPSG\",\"code\":7030}}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"}]},\"remarks\":\"PROJ CRS string: +proj=longlat +ellps=WGS84 +no_defs +lon_wrap=180\"}" }, "lat": { "type": "spatial", @@ -48,7 +48,7 @@ 39.95 ], "step": 0.1, - "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"ProjectedCRS\",\"name\":\"unknown\",\"base_crs\":{\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"unknown\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}},\"conversion\":{\"name\":\"unknown\",\"method\":{\"name\":\"Equidistant Cylindrical\",\"id\":{\"authority\":\"EPSG\",\"code\":1028}},\"parameters\":[{\"name\":\"Latitude of 1st standard parallel\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8823}},{\"name\":\"Latitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8801}},{\"name\":\"Longitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8802}},{\"name\":\"False easting\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8806}},{\"name\":\"False northing\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8807}}]},\"coordinate_system\":{\"subtype\":\"Cartesian\",\"axis\":[{\"name\":\"Easting\",\"abbreviation\":\"E\",\"direction\":\"east\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Northing\",\"abbreviation\":\"N\",\"direction\":\"north\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}}" + "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"GeographicCRS\",\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"Unknown based on WGS 84 ellipsoid\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563,\"id\":{\"authority\":\"EPSG\",\"code\":7030}}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"}]},\"remarks\":\"PROJ CRS string: +proj=longlat +ellps=WGS84 +no_defs +lon_wrap=180\"}" }, "bnds": { "type": "count", @@ -638,9 +638,9 @@ "spatial": { "bbox": [ [ - 251.05, + -108.94999999999999, 26.05, - 269.95, + -90.05, 39.95 ] ] diff --git a/catalog/Red_River_MPI-ESM-LR_historical/collection.json b/catalog/Red_River_MPI-ESM-LR_historical/collection.json index c3bafb1b79aaea161e76d4e905284a3a4417b53e..6f8471be7807642f8f405a637ece12cda3ae26e2 100644 --- a/catalog/Red_River_MPI-ESM-LR_historical/collection.json +++ b/catalog/Red_River_MPI-ESM-LR_historical/collection.json @@ -37,7 +37,7 @@ 269.95 ], "step": 0.1, - "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"ProjectedCRS\",\"name\":\"unknown\",\"base_crs\":{\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"unknown\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}},\"conversion\":{\"name\":\"unknown\",\"method\":{\"name\":\"Equidistant Cylindrical\",\"id\":{\"authority\":\"EPSG\",\"code\":1028}},\"parameters\":[{\"name\":\"Latitude of 1st standard parallel\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8823}},{\"name\":\"Latitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8801}},{\"name\":\"Longitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8802}},{\"name\":\"False easting\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8806}},{\"name\":\"False northing\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8807}}]},\"coordinate_system\":{\"subtype\":\"Cartesian\",\"axis\":[{\"name\":\"Easting\",\"abbreviation\":\"E\",\"direction\":\"east\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Northing\",\"abbreviation\":\"N\",\"direction\":\"north\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}}" + "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"GeographicCRS\",\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"Unknown based on WGS 84 ellipsoid\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563,\"id\":{\"authority\":\"EPSG\",\"code\":7030}}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"}]},\"remarks\":\"PROJ CRS string: +proj=longlat +ellps=WGS84 +no_defs +lon_wrap=180\"}" }, "lat": { "type": "spatial", @@ -48,7 +48,7 @@ 39.95 ], "step": 0.1, - "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"ProjectedCRS\",\"name\":\"unknown\",\"base_crs\":{\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"unknown\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}},\"conversion\":{\"name\":\"unknown\",\"method\":{\"name\":\"Equidistant Cylindrical\",\"id\":{\"authority\":\"EPSG\",\"code\":1028}},\"parameters\":[{\"name\":\"Latitude of 1st standard parallel\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8823}},{\"name\":\"Latitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8801}},{\"name\":\"Longitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8802}},{\"name\":\"False easting\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8806}},{\"name\":\"False northing\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8807}}]},\"coordinate_system\":{\"subtype\":\"Cartesian\",\"axis\":[{\"name\":\"Easting\",\"abbreviation\":\"E\",\"direction\":\"east\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Northing\",\"abbreviation\":\"N\",\"direction\":\"north\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}}" + "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"GeographicCRS\",\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"Unknown based on WGS 84 ellipsoid\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563,\"id\":{\"authority\":\"EPSG\",\"code\":7030}}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"}]},\"remarks\":\"PROJ CRS string: +proj=longlat +ellps=WGS84 +no_defs +lon_wrap=180\"}" }, "bnds": { "type": "count", @@ -278,9 +278,9 @@ "spatial": { "bbox": [ [ - 251.05, + -108.94999999999999, 26.05, - 269.95, + -90.05, 39.95 ] ] diff --git a/catalog/Red_River_future/collection.json b/catalog/Red_River_future/collection.json index eb35533c0dab2f04c89d69ca458c50bb31623873..d4d6ca82e0f4a5769fa6507e0ff0ba5136030b64 100644 --- a/catalog/Red_River_future/collection.json +++ b/catalog/Red_River_future/collection.json @@ -37,7 +37,7 @@ 269.95 ], "step": 0.1, - "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"ProjectedCRS\",\"name\":\"unknown\",\"base_crs\":{\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"unknown\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}},\"conversion\":{\"name\":\"unknown\",\"method\":{\"name\":\"Equidistant Cylindrical\",\"id\":{\"authority\":\"EPSG\",\"code\":1028}},\"parameters\":[{\"name\":\"Latitude of 1st standard parallel\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8823}},{\"name\":\"Latitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8801}},{\"name\":\"Longitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8802}},{\"name\":\"False easting\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8806}},{\"name\":\"False northing\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8807}}]},\"coordinate_system\":{\"subtype\":\"Cartesian\",\"axis\":[{\"name\":\"Easting\",\"abbreviation\":\"E\",\"direction\":\"east\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Northing\",\"abbreviation\":\"N\",\"direction\":\"north\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}}" + "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"GeographicCRS\",\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"Unknown based on WGS 84 ellipsoid\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563,\"id\":{\"authority\":\"EPSG\",\"code\":7030}}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"}]},\"remarks\":\"PROJ CRS string: +proj=longlat +ellps=WGS84 +no_defs +lon_wrap=180\"}" }, "lat": { "type": "spatial", @@ -48,7 +48,7 @@ 39.95 ], "step": 0.1, - "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"ProjectedCRS\",\"name\":\"unknown\",\"base_crs\":{\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"unknown\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}},\"conversion\":{\"name\":\"unknown\",\"method\":{\"name\":\"Equidistant Cylindrical\",\"id\":{\"authority\":\"EPSG\",\"code\":1028}},\"parameters\":[{\"name\":\"Latitude of 1st standard parallel\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8823}},{\"name\":\"Latitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8801}},{\"name\":\"Longitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8802}},{\"name\":\"False easting\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8806}},{\"name\":\"False northing\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8807}}]},\"coordinate_system\":{\"subtype\":\"Cartesian\",\"axis\":[{\"name\":\"Easting\",\"abbreviation\":\"E\",\"direction\":\"east\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Northing\",\"abbreviation\":\"N\",\"direction\":\"north\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}}" + "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"GeographicCRS\",\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"Unknown based on WGS 84 ellipsoid\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563,\"id\":{\"authority\":\"EPSG\",\"code\":7030}}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"}]},\"remarks\":\"PROJ CRS string: +proj=longlat +ellps=WGS84 +no_defs +lon_wrap=180\"}" }, "bnds": { "type": "count", @@ -1168,9 +1168,9 @@ "spatial": { "bbox": [ [ - 251.05, + -108.94999999999999, 26.05, - 269.95, + -90.05, 39.95 ] ] diff --git a/catalog/Red_River_historical/collection.json b/catalog/Red_River_historical/collection.json index f5f815f42c7939105fdfa5711bce256f240108f7..e2bd2b9868b8fbf8c15a318252c5974dd46bb435 100644 --- a/catalog/Red_River_historical/collection.json +++ b/catalog/Red_River_historical/collection.json @@ -37,7 +37,7 @@ 269.95 ], "step": 0.1, - "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"ProjectedCRS\",\"name\":\"unknown\",\"base_crs\":{\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"unknown\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}},\"conversion\":{\"name\":\"unknown\",\"method\":{\"name\":\"Equidistant Cylindrical\",\"id\":{\"authority\":\"EPSG\",\"code\":1028}},\"parameters\":[{\"name\":\"Latitude of 1st standard parallel\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8823}},{\"name\":\"Latitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8801}},{\"name\":\"Longitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8802}},{\"name\":\"False easting\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8806}},{\"name\":\"False northing\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8807}}]},\"coordinate_system\":{\"subtype\":\"Cartesian\",\"axis\":[{\"name\":\"Easting\",\"abbreviation\":\"E\",\"direction\":\"east\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Northing\",\"abbreviation\":\"N\",\"direction\":\"north\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}}" + "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"GeographicCRS\",\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"Unknown based on WGS 84 ellipsoid\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563,\"id\":{\"authority\":\"EPSG\",\"code\":7030}}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"}]},\"remarks\":\"PROJ CRS string: +proj=longlat +ellps=WGS84 +no_defs +lon_wrap=180\"}" }, "lat": { "type": "spatial", @@ -48,7 +48,7 @@ 39.95 ], "step": 0.1, - "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"ProjectedCRS\",\"name\":\"unknown\",\"base_crs\":{\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"unknown\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}},\"conversion\":{\"name\":\"unknown\",\"method\":{\"name\":\"Equidistant Cylindrical\",\"id\":{\"authority\":\"EPSG\",\"code\":1028}},\"parameters\":[{\"name\":\"Latitude of 1st standard parallel\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8823}},{\"name\":\"Latitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8801}},{\"name\":\"Longitude of natural origin\",\"value\":0,\"unit\":\"degree\",\"id\":{\"authority\":\"EPSG\",\"code\":8802}},{\"name\":\"False easting\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8806}},{\"name\":\"False northing\",\"value\":0,\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274},\"id\":{\"authority\":\"EPSG\",\"code\":8807}}]},\"coordinate_system\":{\"subtype\":\"Cartesian\",\"axis\":[{\"name\":\"Easting\",\"abbreviation\":\"E\",\"direction\":\"east\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Northing\",\"abbreviation\":\"N\",\"direction\":\"north\",\"unit\":{\"type\":\"LinearUnit\",\"name\":\"unknown\",\"conversion_factor\":111319.490793274}},{\"name\":\"Ellipsoidal height\",\"abbreviation\":\"h\",\"direction\":\"up\",\"unit\":\"metre\"}]}}" + "reference_system": "{\"$schema\":\"https://proj.org/schemas/v0.5/projjson.schema.json\",\"type\":\"GeographicCRS\",\"name\":\"unknown\",\"datum\":{\"type\":\"GeodeticReferenceFrame\",\"name\":\"Unknown based on WGS 84 ellipsoid\",\"ellipsoid\":{\"name\":\"WGS 84\",\"semi_major_axis\":6378137,\"inverse_flattening\":298.257223563,\"id\":{\"authority\":\"EPSG\",\"code\":7030}}},\"coordinate_system\":{\"subtype\":\"ellipsoidal\",\"axis\":[{\"name\":\"Longitude\",\"abbreviation\":\"lon\",\"direction\":\"east\",\"unit\":\"degree\"},{\"name\":\"Latitude\",\"abbreviation\":\"lat\",\"direction\":\"north\",\"unit\":\"degree\"}]},\"remarks\":\"PROJ CRS string: +proj=longlat +ellps=WGS84 +no_defs +lon_wrap=180\"}" }, "bnds": { "type": "count", @@ -458,9 +458,9 @@ "spatial": { "bbox": [ [ - 251.05, + -108.94999999999999, 26.05, - 269.95, + -90.05, 39.95 ] ] diff --git a/workflows/archive/Red_River_MPI-ESM-LR_future_create_collection_from_zarr.ipynb b/workflows/archive/Red_River_MPI-ESM-LR_future_create_collection_from_zarr.ipynb index 02374c828d157e89efd198d05db28882806ee618..e3555e1661e3263e8b16e05decb41b0406b1294c 100644 --- a/workflows/archive/Red_River_MPI-ESM-LR_future_create_collection_from_zarr.ipynb +++ b/workflows/archive/Red_River_MPI-ESM-LR_future_create_collection_from_zarr.ipynb @@ -33,7 +33,8 @@ "import pandas as pd\n", "import json\n", "import numpy as np\n", - "import metpy\n", + "import pyproj\n", + "from pyproj import Transformer\n", "import cartopy.crs as ccrs\n", "import cfunits\n", "import json\n", @@ -206,6 +207,18 @@ "## Get crs info" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "1a5e0bed-68f9-4b99-8d96-0831e9348a4e", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "crs_var = 'crs'" + ] + }, { "cell_type": "code", "execution_count": null, @@ -213,8 +226,37 @@ "metadata": {}, "outputs": [], "source": [ - "ds = ds.metpy.parse_cf()\n", - "crs = ds[list(ds.keys())[0]].metpy.cartopy_crs" + "# use pyproj to automatically extract crs info\n", + "crs = pyproj.CRS.from_cf(ds[crs_var].attrs)\n", + "\n", + "# alternatively, create the appropriate cartopy projection\n", + "# crs = ccrs.LambertConformal(central_longitude=crs_info.longitude_of_central_meridian, \n", + "# central_latitude=crs_info.latitude_of_projection_origin,\n", + "# standard_parallels=crs_info.standard_parallel)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "02aa1616-5878-4f61-abe8-905f3c918407", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "ds.crs" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6d0e5c7f-0b7d-4b3f-aa6b-a41d92281dd3", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "crs.to_proj4()" ] }, { @@ -245,14 +287,63 @@ "# coordinates must be from WGS 84 datum\n", "# left, bottom, right, top\n", "\n", - "# Note: try changing around the commented out lines below to get type float ratherthan a numpy float\n", - "#coord_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float), ds[dim_names_dict['Y']].data.min().compute().astype(float), ds[dim_names_dict['X']].data.max().compute().astype(float), ds[dim_names_dict['Y']].data.max().compute().astype(float)]\n", - "#coord_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['X']].data.max().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.max().compute().astype(float).tolist()]\n", - "coord_bounds = [ds[dim_names_dict['X']].data.min().astype(float).item(), ds[dim_names_dict['Y']].data.min().astype(float).item(), ds[dim_names_dict['X']].data.max().astype(float).item(), ds[dim_names_dict['Y']].data.max().astype(float).item()]\n", - "print(coord_bounds)\n", - "print(f'\\ncoord_bounds data type: {type(coord_bounds[0])}')\n", + "# Note: try changing around the commented out lines below to get type float rather than a numpy float\n", + "#spatial_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float), ds[dim_names_dict['Y']].data.min().compute().astype(float), ds[dim_names_dict['X']].data.max().compute().astype(float), ds[dim_names_dict['Y']].data.max().compute().astype(float)]\n", + "#spatial_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['X']].data.max().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.max().compute().astype(float).tolist()]\n", + "spatial_bounds = [ds[dim_names_dict['X']].data.min().astype(float).item(), ds[dim_names_dict['Y']].data.min().astype(float).item(), ds[dim_names_dict['X']].data.max().astype(float).item(), ds[dim_names_dict['Y']].data.max().astype(float).item()]\n", + "print(spatial_bounds)\n", + "print(f'\\nspatial_bounds data type: {type(spatial_bounds[0])}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fecaf3b8-f621-4c8a-9759-85b4a978d416", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "XX, YY = np.meshgrid(ds[dim_names_dict['X']].data, ds[dim_names_dict['Y']].data)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "02eb477c-f74d-4b22-8d8a-f9ffbb79047c", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "transformer = Transformer.from_crs(crs, \"EPSG:4326\", always_xy=True)\n", + "lon, lat = transformer.transform(XX.ravel(), YY.ravel())" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ab4e717c-8b91-4cb8-98ef-c81c0e40e330", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "print(f'lower left coordinates (WGS84): {min(lon)}, {min(lat)}')\n", + "print(f'upper right coordinates (WGS84): {max(lon)}, {max(lat)}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f8061e60-3663-41f2-a6fa-ee6be15a6d76", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ "# create a spatial extent object \n", - "spatial_extent = pystac.SpatialExtent(bboxes=[coord_bounds])" + "spatial_extent = pystac.SpatialExtent(bboxes=[[min(lon).item(), min(lat).item(), max(lon).item(), max(lat).item()]])" ] }, { @@ -420,18 +511,6 @@ "print(dims)" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "00a18a29-fb9a-4b56-8009-493122997b16", - "metadata": {}, - "outputs": [], - "source": [ - "# get x, y bounds for extent of those dimensions (required)\n", - "xy_bounds = [ds[dim_names_dict['X']].data.min().astype(float).item(), ds[dim_names_dict['Y']].data.min().astype(float).item(), ds[dim_names_dict['X']].data.max().astype(float).item(), ds[dim_names_dict['Y']].data.max().astype(float).item()]\n", - "print(xy_bounds)" - ] - }, { "cell_type": "markdown", "id": "e7dc357c-91ec-49ae-83e5-400f791f9792", @@ -441,17 +520,6 @@ "reference list of cartopy projections: https://scitools.org.uk/cartopy/docs/latest/reference/projections.html" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "ea452f62-5644-49b6-8a4e-7dc4f649fd1a", - "metadata": {}, - "outputs": [], - "source": [ - "# print out crs information in dataset\n", - "print(crs)" - ] - }, { "cell_type": "code", "execution_count": null, @@ -661,12 +729,25 @@ "# we do not recommend including redundant dimensions (do not include x,y if you have lon,lat)\n", "# note that the extent of each dimension should be pulled from the dataset\n", "dims_dict = {dim_names_dict['T']: pystac.extensions.datacube.Dimension({'type': 'temporal', 'description': stac_helpers.get_long_name(ds, dim_names_dict['T']), 'extent': [temporal_extent_lower.strftime('%Y-%m-%dT%XZ'), temporal_extent_upper.strftime('%Y-%m-%dT%XZ')], 'step':time_step}),\n", - " dim_names_dict['X']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'x', 'description': stac_helpers.get_long_name(ds, dim_names_dict['X']), 'extent': [xy_bounds[0], xy_bounds[2]], 'step': x_step, 'reference_system': projjson}),\n", - " dim_names_dict['Y']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'y', 'description': stac_helpers.get_long_name(ds, dim_names_dict['Y']), 'extent': [xy_bounds[1], xy_bounds[3]], 'step': y_step, 'reference_system': projjson}),\n", + " dim_names_dict['X']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'x', 'description': stac_helpers.get_long_name(ds, dim_names_dict['X']), 'extent': [spatial_bounds[0], spatial_bounds[2]], 'step': x_step, 'reference_system': projjson}),\n", + " dim_names_dict['Y']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'y', 'description': stac_helpers.get_long_name(ds, dim_names_dict['Y']), 'extent': [spatial_bounds[1], spatial_bounds[3]], 'step': y_step, 'reference_system': projjson}),\n", " 'bnds': pystac.extensions.datacube.Dimension({'type': 'count', 'description': stac_helpers.get_long_name(ds, 'bnds'), 'extent': [ds.bnds.min().item(), ds.bnds.max().item()]}),\n", " }" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "14cf211f-e421-4893-929e-b158940576d6", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# make sure you added all the right dims\n", + "assert sorted(list(dims_dict.keys())) == sorted(dims)" + ] + }, { "cell_type": "markdown", "id": "0f277883-a3fd-425f-966a-ca2140d0ef2f", @@ -702,7 +783,7 @@ "vars_dict={}\n", "for v in vars:\n", " unit = stac_helpers.get_unit(ds, v)\n", - " var_type = stac_helpers.get_var_type(ds, v)\n", + " var_type = stac_helpers.get_var_type(ds, v, crs_var)\n", " long_name = stac_helpers.get_long_name(ds, v)\n", " vars_dict[v] = pystac.extensions.datacube.Variable({'dimensions':list(ds[v].dims), 'type': var_type, 'description': long_name, 'unit': unit})" ] diff --git a/workflows/archive/Red_River_MPI-ESM-LR_historical_create_collection_from_zarr.ipynb b/workflows/archive/Red_River_MPI-ESM-LR_historical_create_collection_from_zarr.ipynb index 210edd5ab44e978073d0f77c4a0e28c5993ad5e3..1ed66e419bbff061d044691aa55258c295902029 100644 --- a/workflows/archive/Red_River_MPI-ESM-LR_historical_create_collection_from_zarr.ipynb +++ b/workflows/archive/Red_River_MPI-ESM-LR_historical_create_collection_from_zarr.ipynb @@ -33,7 +33,8 @@ "import pandas as pd\n", "import json\n", "import numpy as np\n", - "import metpy\n", + "import pyproj\n", + "from pyproj import Transformer\n", "import cartopy.crs as ccrs\n", "import cfunits\n", "import json\n", @@ -206,6 +207,18 @@ "## Get crs info" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "0206f01c-02bb-42d8-885d-6b1644fba9cc", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "crs_var = 'crs'" + ] + }, { "cell_type": "code", "execution_count": null, @@ -213,8 +226,37 @@ "metadata": {}, "outputs": [], "source": [ - "ds = ds.metpy.parse_cf()\n", - "crs = ds[list(ds.keys())[0]].metpy.cartopy_crs" + "# use pyproj to automatically extract crs info\n", + "crs = pyproj.CRS.from_cf(ds[crs_var].attrs)\n", + "\n", + "# alternatively, create the appropriate cartopy projection\n", + "# crs = ccrs.LambertConformal(central_longitude=crs_info.longitude_of_central_meridian, \n", + "# central_latitude=crs_info.latitude_of_projection_origin,\n", + "# standard_parallels=crs_info.standard_parallel)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b98a6623-56fd-47f5-8dbf-492476995c31", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "ds.crs" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "25de71e9-52bc-404e-918c-5fd75cadf654", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "crs.to_proj4()" ] }, { @@ -245,14 +287,63 @@ "# coordinates must be from WGS 84 datum\n", "# left, bottom, right, top\n", "\n", - "# Note: try changing around the commented out lines below to get type float ratherthan a numpy float\n", - "#coord_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float), ds[dim_names_dict['Y']].data.min().compute().astype(float), ds[dim_names_dict['X']].data.max().compute().astype(float), ds[dim_names_dict['Y']].data.max().compute().astype(float)]\n", - "#coord_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['X']].data.max().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.max().compute().astype(float).tolist()]\n", - "coord_bounds = [ds[dim_names_dict['X']].data.min().astype(float).item(), ds[dim_names_dict['Y']].data.min().astype(float).item(), ds[dim_names_dict['X']].data.max().astype(float).item(), ds[dim_names_dict['Y']].data.max().astype(float).item()]\n", - "print(coord_bounds)\n", - "print(f'\\ncoord_bounds data type: {type(coord_bounds[0])}')\n", + "# Note: try changing around the commented out lines below to get type float rather than a numpy float\n", + "#spatial_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float), ds[dim_names_dict['Y']].data.min().compute().astype(float), ds[dim_names_dict['X']].data.max().compute().astype(float), ds[dim_names_dict['Y']].data.max().compute().astype(float)]\n", + "#spatial_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['X']].data.max().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.max().compute().astype(float).tolist()]\n", + "spatial_bounds = [ds[dim_names_dict['X']].data.min().astype(float).item(), ds[dim_names_dict['Y']].data.min().astype(float).item(), ds[dim_names_dict['X']].data.max().astype(float).item(), ds[dim_names_dict['Y']].data.max().astype(float).item()]\n", + "print(spatial_bounds)\n", + "print(f'\\nspatial_bounds data type: {type(spatial_bounds[0])}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b82a761b-2444-4ea1-9f0a-1544b422b765", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "XX, YY = np.meshgrid(ds[dim_names_dict['X']].data, ds[dim_names_dict['Y']].data)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eb4a8cdb-2ecc-42c5-b4fe-04a6c36df375", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "transformer = Transformer.from_crs(crs, \"EPSG:4326\", always_xy=True)\n", + "lon, lat = transformer.transform(XX.ravel(), YY.ravel())" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eab19bc2-c275-4414-b302-1acac3cbbfa4", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "print(f'lower left coordinates (WGS84): {min(lon)}, {min(lat)}')\n", + "print(f'upper right coordinates (WGS84): {max(lon)}, {max(lat)}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "434e3d31-6040-43fc-89d8-2a9bceeade31", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ "# create a spatial extent object \n", - "spatial_extent = pystac.SpatialExtent(bboxes=[coord_bounds])" + "spatial_extent = pystac.SpatialExtent(bboxes=[[min(lon).item(), min(lat).item(), max(lon).item(), max(lat).item()]])" ] }, { @@ -420,18 +511,6 @@ "print(dims)" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "00a18a29-fb9a-4b56-8009-493122997b16", - "metadata": {}, - "outputs": [], - "source": [ - "# get x, y bounds for extent of those dimensions (required)\n", - "xy_bounds = [ds[dim_names_dict['X']].data.min().astype(float).item(), ds[dim_names_dict['Y']].data.min().astype(float).item(), ds[dim_names_dict['X']].data.max().astype(float).item(), ds[dim_names_dict['Y']].data.max().astype(float).item()]\n", - "print(xy_bounds)" - ] - }, { "cell_type": "markdown", "id": "e7dc357c-91ec-49ae-83e5-400f791f9792", @@ -441,17 +520,6 @@ "reference list of cartopy projections: https://scitools.org.uk/cartopy/docs/latest/reference/projections.html" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "ea452f62-5644-49b6-8a4e-7dc4f649fd1a", - "metadata": {}, - "outputs": [], - "source": [ - "# print out crs information in dataset\n", - "print(crs)" - ] - }, { "cell_type": "code", "execution_count": null, @@ -661,12 +729,25 @@ "# we do not recommend including redundant dimensions (do not include x,y if you have lon,lat)\n", "# note that the extent of each dimension should be pulled from the dataset\n", "dims_dict = {dim_names_dict['T']: pystac.extensions.datacube.Dimension({'type': 'temporal', 'description': stac_helpers.get_long_name(ds, dim_names_dict['T']), 'extent': [temporal_extent_lower.strftime('%Y-%m-%dT%XZ'), temporal_extent_upper.strftime('%Y-%m-%dT%XZ')], 'step':time_step}),\n", - " dim_names_dict['X']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'x', 'description': stac_helpers.get_long_name(ds, dim_names_dict['X']), 'extent': [xy_bounds[0], xy_bounds[2]], 'step': x_step, 'reference_system': projjson}),\n", - " dim_names_dict['Y']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'y', 'description': stac_helpers.get_long_name(ds, dim_names_dict['Y']), 'extent': [xy_bounds[1], xy_bounds[3]], 'step': y_step, 'reference_system': projjson}),\n", + " dim_names_dict['X']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'x', 'description': stac_helpers.get_long_name(ds, dim_names_dict['X']), 'extent': [spatial_bounds[0], spatial_bounds[2]], 'step': x_step, 'reference_system': projjson}),\n", + " dim_names_dict['Y']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'y', 'description': stac_helpers.get_long_name(ds, dim_names_dict['Y']), 'extent': [spatial_bounds[1], spatial_bounds[3]], 'step': y_step, 'reference_system': projjson}),\n", " 'bnds': pystac.extensions.datacube.Dimension({'type': 'count', 'description': stac_helpers.get_long_name(ds, 'bnds'), 'extent': [ds.bnds.min().item(), ds.bnds.max().item()]}),\n", " }" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "f07272be-1a13-481b-bf8a-f135ce0da1d4", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# make sure you added all the right dims\n", + "assert sorted(list(dims_dict.keys())) == sorted(dims)" + ] + }, { "cell_type": "markdown", "id": "0f277883-a3fd-425f-966a-ca2140d0ef2f", @@ -702,7 +783,7 @@ "vars_dict={}\n", "for v in vars:\n", " unit = stac_helpers.get_unit(ds, v)\n", - " var_type = stac_helpers.get_var_type(ds, v)\n", + " var_type = stac_helpers.get_var_type(ds, v, crs_var)\n", " long_name = stac_helpers.get_long_name(ds, v)\n", " vars_dict[v] = pystac.extensions.datacube.Variable({'dimensions':list(ds[v].dims), 'type': var_type, 'description': long_name, 'unit': unit})" ] diff --git a/workflows/archive/Red_River_future_create_collection_from_zarr.ipynb b/workflows/archive/Red_River_future_create_collection_from_zarr.ipynb index 60bc2ba7cff68909889d78dfb275c7afcac9e94c..9f282764d46d174773965276901fc0341f6ae510 100644 --- a/workflows/archive/Red_River_future_create_collection_from_zarr.ipynb +++ b/workflows/archive/Red_River_future_create_collection_from_zarr.ipynb @@ -33,7 +33,8 @@ "import pandas as pd\n", "import json\n", "import numpy as np\n", - "import metpy\n", + "import pyproj\n", + "from pyproj import Transformer\n", "import cartopy.crs as ccrs\n", "import cfunits\n", "import json\n", @@ -206,6 +207,18 @@ "## Get crs info" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "4228e138-c46d-45fd-8f74-80f27972179c", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "crs_var = 'crs'" + ] + }, { "cell_type": "code", "execution_count": null, @@ -213,8 +226,37 @@ "metadata": {}, "outputs": [], "source": [ - "ds = ds.metpy.parse_cf()\n", - "crs = ds[list(ds.keys())[0]].metpy.cartopy_crs" + "# use pyproj to automatically extract crs info\n", + "crs = pyproj.CRS.from_cf(ds[crs_var].attrs)\n", + "\n", + "# alternatively, create the appropriate cartopy projection\n", + "# crs = ccrs.LambertConformal(central_longitude=crs_info.longitude_of_central_meridian, \n", + "# central_latitude=crs_info.latitude_of_projection_origin,\n", + "# standard_parallels=crs_info.standard_parallel)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "56a4af3d-0134-40d6-9599-e4c250bb5328", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "ds.crs" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cb57bd22-ba01-4462-bc11-b7ec898b1c33", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "crs.to_proj4()" ] }, { @@ -245,14 +287,63 @@ "# coordinates must be from WGS 84 datum\n", "# left, bottom, right, top\n", "\n", - "# Note: try changing around the commented out lines below to get type float ratherthan a numpy float\n", - "#coord_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float), ds[dim_names_dict['Y']].data.min().compute().astype(float), ds[dim_names_dict['X']].data.max().compute().astype(float), ds[dim_names_dict['Y']].data.max().compute().astype(float)]\n", - "#coord_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['X']].data.max().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.max().compute().astype(float).tolist()]\n", - "coord_bounds = [ds[dim_names_dict['X']].data.min().astype(float).item(), ds[dim_names_dict['Y']].data.min().astype(float).item(), ds[dim_names_dict['X']].data.max().astype(float).item(), ds[dim_names_dict['Y']].data.max().astype(float).item()]\n", - "print(coord_bounds)\n", - "print(f'\\ncoord_bounds data type: {type(coord_bounds[0])}')\n", + "# Note: try changing around the commented out lines below to get type float rather than a numpy float\n", + "#spatial_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float), ds[dim_names_dict['Y']].data.min().compute().astype(float), ds[dim_names_dict['X']].data.max().compute().astype(float), ds[dim_names_dict['Y']].data.max().compute().astype(float)]\n", + "#spatial_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['X']].data.max().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.max().compute().astype(float).tolist()]\n", + "spatial_bounds = [ds[dim_names_dict['X']].data.min().astype(float).item(), ds[dim_names_dict['Y']].data.min().astype(float).item(), ds[dim_names_dict['X']].data.max().astype(float).item(), ds[dim_names_dict['Y']].data.max().astype(float).item()]\n", + "print(spatial_bounds)\n", + "print(f'\\nspatial_bounds data type: {type(spatial_bounds[0])}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "21ade03d-5058-4b4f-9c07-3746343783d0", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "XX, YY = np.meshgrid(ds[dim_names_dict['X']].data, ds[dim_names_dict['Y']].data)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6bc8bc0e-a495-45ed-ac04-4d4c65c07650", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "transformer = Transformer.from_crs(crs, \"EPSG:4326\", always_xy=True)\n", + "lon, lat = transformer.transform(XX.ravel(), YY.ravel())" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3c9f851a-6445-472e-a4a5-bd462fac3fa8", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "print(f'lower left coordinates (WGS84): {min(lon)}, {min(lat)}')\n", + "print(f'upper right coordinates (WGS84): {max(lon)}, {max(lat)}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "34d7f4bc-b532-492a-9a7d-d6ff1d3b9f82", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ "# create a spatial extent object \n", - "spatial_extent = pystac.SpatialExtent(bboxes=[coord_bounds])" + "spatial_extent = pystac.SpatialExtent(bboxes=[[min(lon).item(), min(lat).item(), max(lon).item(), max(lat).item()]])" ] }, { @@ -420,18 +511,6 @@ "print(dims)" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "00a18a29-fb9a-4b56-8009-493122997b16", - "metadata": {}, - "outputs": [], - "source": [ - "# get x, y bounds for extent of those dimensions (required)\n", - "xy_bounds = [ds[dim_names_dict['X']].data.min().astype(float).item(), ds[dim_names_dict['Y']].data.min().astype(float).item(), ds[dim_names_dict['X']].data.max().astype(float).item(), ds[dim_names_dict['Y']].data.max().astype(float).item()]\n", - "print(xy_bounds)" - ] - }, { "cell_type": "markdown", "id": "e7dc357c-91ec-49ae-83e5-400f791f9792", @@ -441,17 +520,6 @@ "reference list of cartopy projections: https://scitools.org.uk/cartopy/docs/latest/reference/projections.html" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "ea452f62-5644-49b6-8a4e-7dc4f649fd1a", - "metadata": {}, - "outputs": [], - "source": [ - "# print out crs information in dataset\n", - "print(crs)" - ] - }, { "cell_type": "code", "execution_count": null, @@ -661,12 +729,25 @@ "# we do not recommend including redundant dimensions (do not include x,y if you have lon,lat)\n", "# note that the extent of each dimension should be pulled from the dataset\n", "dims_dict = {dim_names_dict['T']: pystac.extensions.datacube.Dimension({'type': 'temporal', 'description': stac_helpers.get_long_name(ds, dim_names_dict['T']), 'extent': [temporal_extent_lower.strftime('%Y-%m-%dT%XZ'), temporal_extent_upper.strftime('%Y-%m-%dT%XZ')], 'step':time_step}),\n", - " dim_names_dict['X']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'x', 'description': stac_helpers.get_long_name(ds, dim_names_dict['X']), 'extent': [xy_bounds[0], xy_bounds[2]], 'step': x_step, 'reference_system': projjson}),\n", - " dim_names_dict['Y']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'y', 'description': stac_helpers.get_long_name(ds, dim_names_dict['Y']), 'extent': [xy_bounds[1], xy_bounds[3]], 'step': y_step, 'reference_system': projjson}),\n", + " dim_names_dict['X']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'x', 'description': stac_helpers.get_long_name(ds, dim_names_dict['X']), 'extent': [spatial_bounds[0], spatial_bounds[2]], 'step': x_step, 'reference_system': projjson}),\n", + " dim_names_dict['Y']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'y', 'description': stac_helpers.get_long_name(ds, dim_names_dict['Y']), 'extent': [spatial_bounds[1], spatial_bounds[3]], 'step': y_step, 'reference_system': projjson}),\n", " 'bnds': pystac.extensions.datacube.Dimension({'type': 'count', 'description': stac_helpers.get_long_name(ds, 'bnds'), 'extent': [ds.bnds.min().item(), ds.bnds.max().item()]}),\n", " }" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "fa518622-9b12-4823-9eac-26ec432fc5f0", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# make sure you added all the right dims\n", + "assert sorted(list(dims_dict.keys())) == sorted(dims)" + ] + }, { "cell_type": "markdown", "id": "0f277883-a3fd-425f-966a-ca2140d0ef2f", @@ -702,7 +783,7 @@ "vars_dict={}\n", "for v in vars:\n", " unit = stac_helpers.get_unit(ds, v)\n", - " var_type = stac_helpers.get_var_type(ds, v)\n", + " var_type = stac_helpers.get_var_type(ds, v, crs_var)\n", " long_name = stac_helpers.get_long_name(ds, v)\n", " vars_dict[v] = pystac.extensions.datacube.Variable({'dimensions':list(ds[v].dims), 'type': var_type, 'description': long_name, 'unit': unit})" ] diff --git a/workflows/archive/Red_River_historical_create_collection_from_zarr.ipynb b/workflows/archive/Red_River_historical_create_collection_from_zarr.ipynb index eb6a317a91dc621635452bbad4cd43af95a76028..2d992eafb634744a0d4beec3c4ed40191b8d7168 100644 --- a/workflows/archive/Red_River_historical_create_collection_from_zarr.ipynb +++ b/workflows/archive/Red_River_historical_create_collection_from_zarr.ipynb @@ -33,7 +33,8 @@ "import pandas as pd\n", "import json\n", "import numpy as np\n", - "import metpy\n", + "import pyproj\n", + "from pyproj import Transformer\n", "import cartopy.crs as ccrs\n", "import cfunits\n", "import json\n", @@ -206,6 +207,18 @@ "## Get crs info" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "840c5128-1928-4011-a52b-e9b35ab313d5", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "crs_var = 'crs'" + ] + }, { "cell_type": "code", "execution_count": null, @@ -213,8 +226,37 @@ "metadata": {}, "outputs": [], "source": [ - "ds = ds.metpy.parse_cf()\n", - "crs = ds[list(ds.keys())[0]].metpy.cartopy_crs" + "# use pyproj to automatically extract crs info\n", + "crs = pyproj.CRS.from_cf(ds[crs_var].attrs)\n", + "\n", + "# alternatively, create the appropriate cartopy projection\n", + "# crs = ccrs.LambertConformal(central_longitude=crs_info.longitude_of_central_meridian, \n", + "# central_latitude=crs_info.latitude_of_projection_origin,\n", + "# standard_parallels=crs_info.standard_parallel)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bd348e57-03f5-4518-af62-527e89681466", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "ds.crs" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "757cd712-fc3b-4bfc-a2b7-73ccd02348c9", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "crs.to_proj4()" ] }, { @@ -245,14 +287,63 @@ "# coordinates must be from WGS 84 datum\n", "# left, bottom, right, top\n", "\n", - "# Note: try changing around the commented out lines below to get type float ratherthan a numpy float\n", - "#coord_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float), ds[dim_names_dict['Y']].data.min().compute().astype(float), ds[dim_names_dict['X']].data.max().compute().astype(float), ds[dim_names_dict['Y']].data.max().compute().astype(float)]\n", - "#coord_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['X']].data.max().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.max().compute().astype(float).tolist()]\n", - "coord_bounds = [ds[dim_names_dict['X']].data.min().astype(float).item(), ds[dim_names_dict['Y']].data.min().astype(float).item(), ds[dim_names_dict['X']].data.max().astype(float).item(), ds[dim_names_dict['Y']].data.max().astype(float).item()]\n", - "print(coord_bounds)\n", - "print(f'\\ncoord_bounds data type: {type(coord_bounds[0])}')\n", + "# Note: try changing around the commented out lines below to get type float rather than a numpy float\n", + "#spatial_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float), ds[dim_names_dict['Y']].data.min().compute().astype(float), ds[dim_names_dict['X']].data.max().compute().astype(float), ds[dim_names_dict['Y']].data.max().compute().astype(float)]\n", + "#spatial_bounds = [ds[dim_names_dict['X']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.min().compute().astype(float).tolist(), ds[dim_names_dict['X']].data.max().compute().astype(float).tolist(), ds[dim_names_dict['Y']].data.max().compute().astype(float).tolist()]\n", + "spatial_bounds = [ds[dim_names_dict['X']].data.min().astype(float).item(), ds[dim_names_dict['Y']].data.min().astype(float).item(), ds[dim_names_dict['X']].data.max().astype(float).item(), ds[dim_names_dict['Y']].data.max().astype(float).item()]\n", + "print(spatial_bounds)\n", + "print(f'\\nspatial_bounds data type: {type(spatial_bounds[0])}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "614ed34a-6cf7-48ec-8bac-efc22afd6790", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "XX, YY = np.meshgrid(ds[dim_names_dict['X']].data, ds[dim_names_dict['Y']].data)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ca67d6ee-6e1d-450d-958d-52d11d3aa8e7", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "transformer = Transformer.from_crs(crs, \"EPSG:4326\", always_xy=True)\n", + "lon, lat = transformer.transform(XX.ravel(), YY.ravel())" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d88d7600-e7ba-4836-b427-92d97a8b1b8b", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "print(f'lower left coordinates (WGS84): {min(lon)}, {min(lat)}')\n", + "print(f'upper right coordinates (WGS84): {max(lon)}, {max(lat)}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c3639565-c00f-4490-8823-aa791b989c23", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ "# create a spatial extent object \n", - "spatial_extent = pystac.SpatialExtent(bboxes=[coord_bounds])" + "spatial_extent = pystac.SpatialExtent(bboxes=[[min(lon).item(), min(lat).item(), max(lon).item(), max(lat).item()]])" ] }, { @@ -420,18 +511,6 @@ "print(dims)" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "00a18a29-fb9a-4b56-8009-493122997b16", - "metadata": {}, - "outputs": [], - "source": [ - "# get x, y bounds for extent of those dimensions (required)\n", - "xy_bounds = [ds[dim_names_dict['X']].data.min().astype(float).item(), ds[dim_names_dict['Y']].data.min().astype(float).item(), ds[dim_names_dict['X']].data.max().astype(float).item(), ds[dim_names_dict['Y']].data.max().astype(float).item()]\n", - "print(xy_bounds)" - ] - }, { "cell_type": "markdown", "id": "e7dc357c-91ec-49ae-83e5-400f791f9792", @@ -441,17 +520,6 @@ "reference list of cartopy projections: https://scitools.org.uk/cartopy/docs/latest/reference/projections.html" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "ea452f62-5644-49b6-8a4e-7dc4f649fd1a", - "metadata": {}, - "outputs": [], - "source": [ - "# print out crs information in dataset\n", - "print(crs)" - ] - }, { "cell_type": "code", "execution_count": null, @@ -661,12 +729,25 @@ "# we do not recommend including redundant dimensions (do not include x,y if you have lon,lat)\n", "# note that the extent of each dimension should be pulled from the dataset\n", "dims_dict = {dim_names_dict['T']: pystac.extensions.datacube.Dimension({'type': 'temporal', 'description': stac_helpers.get_long_name(ds, dim_names_dict['T']), 'extent': [temporal_extent_lower.strftime('%Y-%m-%dT%XZ'), temporal_extent_upper.strftime('%Y-%m-%dT%XZ')], 'step':time_step}),\n", - " dim_names_dict['X']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'x', 'description': stac_helpers.get_long_name(ds, dim_names_dict['X']), 'extent': [xy_bounds[0], xy_bounds[2]], 'step': x_step, 'reference_system': projjson}),\n", - " dim_names_dict['Y']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'y', 'description': stac_helpers.get_long_name(ds, dim_names_dict['Y']), 'extent': [xy_bounds[1], xy_bounds[3]], 'step': y_step, 'reference_system': projjson}),\n", + " dim_names_dict['X']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'x', 'description': stac_helpers.get_long_name(ds, dim_names_dict['X']), 'extent': [spatial_bounds[0], spatial_bounds[2]], 'step': x_step, 'reference_system': projjson}),\n", + " dim_names_dict['Y']: pystac.extensions.datacube.Dimension({'type': 'spatial', 'axis': 'y', 'description': stac_helpers.get_long_name(ds, dim_names_dict['Y']), 'extent': [spatial_bounds[1], spatial_bounds[3]], 'step': y_step, 'reference_system': projjson}),\n", " 'bnds': pystac.extensions.datacube.Dimension({'type': 'count', 'description': stac_helpers.get_long_name(ds, 'bnds'), 'extent': [ds.bnds.min().item(), ds.bnds.max().item()]}),\n", " }" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "91bfa7db-1887-464c-9bc2-4d870a5c2d01", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# make sure you added all the right dims\n", + "assert sorted(list(dims_dict.keys())) == sorted(dims)" + ] + }, { "cell_type": "markdown", "id": "0f277883-a3fd-425f-966a-ca2140d0ef2f", @@ -702,7 +783,7 @@ "vars_dict={}\n", "for v in vars:\n", " unit = stac_helpers.get_unit(ds, v)\n", - " var_type = stac_helpers.get_var_type(ds, v)\n", + " var_type = stac_helpers.get_var_type(ds, v, crs_var)\n", " long_name = stac_helpers.get_long_name(ds, v)\n", " vars_dict[v] = pystac.extensions.datacube.Variable({'dimensions':list(ds[v].dims), 'type': var_type, 'description': long_name, 'unit': unit})" ] diff --git a/workflows/examples/create_collection_from_zarr_conus404-daily.ipynb b/workflows/examples/create_collection_from_zarr_conus404-daily.ipynb index 29e27fc1147ae86d788b89aaf79b6c4ccf2bfcf2..58161e5ad0b7268bc9b395e155db170d92319bf4 100644 --- a/workflows/examples/create_collection_from_zarr_conus404-daily.ipynb +++ b/workflows/examples/create_collection_from_zarr_conus404-daily.ipynb @@ -194,6 +194,16 @@ "If there is no crs info that can be automatically extracted from the dataset with pyproj, you will need to manually identify the crs and create a crs object. This reference list of cartopy projections may be a helpful resource: https://scitools.org.uk/cartopy/docs/latest/reference/projections.html" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "239d3b00-77f9-4178-954b-ba81a2b34512", + "metadata": {}, + "outputs": [], + "source": [ + "crs_var = 'crs'" + ] + }, { "cell_type": "code", "execution_count": null, @@ -202,7 +212,7 @@ "outputs": [], "source": [ "# use pyproj to automatically extract crs info\n", - "crs = pyproj.CRS.from_cf(ds.crs.attrs)\n", + "crs = pyproj.CRS.from_cf(ds[crs_var].attrs)\n", "\n", "# alternatively, create the appropriate cartopy projection\n", "# crs = ccrs.LambertConformal(central_longitude=crs_info.longitude_of_central_meridian, \n", @@ -821,7 +831,7 @@ "vars_dict={}\n", "for v in vars:\n", " unit = stac_helpers.get_unit(ds, v)\n", - " var_type = stac_helpers.get_var_type(ds, v)\n", + " var_type = stac_helpers.get_var_type(ds, v, crs_var)\n", " long_name = stac_helpers.get_long_name(ds, v)\n", " vars_dict[v] = pystac.extensions.datacube.Variable({'dimensions':list(ds[v].dims), 'type': var_type, 'description': long_name, 'unit': unit})" ] diff --git a/workflows/examples/create_item_from_zarr_conus404-daily.ipynb b/workflows/examples/create_item_from_zarr_conus404-daily.ipynb index 250d7781293cd412339ac5f60cac26d0e7a24749..ad517d534a202cf8c06b1d087f4fbe54bd6612c6 100644 --- a/workflows/examples/create_item_from_zarr_conus404-daily.ipynb +++ b/workflows/examples/create_item_from_zarr_conus404-daily.ipynb @@ -178,6 +178,16 @@ "If there is no crs info that can be automatically extracted from the dataset with pyproj, you will need to manually identify the crs and create a crs object. This reference list of cartopy projections may be a helpful resource: https://scitools.org.uk/cartopy/docs/latest/reference/projections.html" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "6bae3ab0-b0cc-4486-aaaf-209c4d30ec1f", + "metadata": {}, + "outputs": [], + "source": [ + "crs_var = 'crs'" + ] + }, { "cell_type": "code", "execution_count": null, @@ -186,7 +196,7 @@ "outputs": [], "source": [ "# use pyproj to automatically extract crs info\n", - "crs = pyproj.CRS.from_cf(ds.crs.attrs)\n", + "crs = pyproj.CRS.from_cf(ds[crs_var].attrs)\n", "\n", "# alternatively, create the appropriate cartopy projection\n", "# crs = ccrs.LambertConformal(central_longitude=crs_info.longitude_of_central_meridian, \n", @@ -808,7 +818,7 @@ "vars_dict={}\n", "for v in vars:\n", " unit = stac_helpers.get_unit(ds, v)\n", - " var_type = stac_helpers.get_var_type(ds, v)\n", + " var_type = stac_helpers.get_var_type(ds, v, crs_var)\n", " long_name = stac_helpers.get_long_name(ds, v)\n", " vars_dict[v] = pystac.extensions.datacube.Variable({'dimensions':list(ds[v].dims), 'type': var_type, 'description': long_name, 'unit': unit})" ] diff --git a/workflows/stac_helpers.py b/workflows/stac_helpers.py index a246630548f10b910a09f7ddb07e911255d997ed..55801bc9c7eb320ca7fcfa3fd4ee40d2da38c1eb 100644 --- a/workflows/stac_helpers.py +++ b/workflows/stac_helpers.py @@ -99,8 +99,8 @@ def get_unit(ds, v): assert cfunits.Units(unit).isvalid return unit -def get_var_type(ds, v): - if v in ds.coords: +def get_var_type(ds, v, crs_var): + if v in ds.coords or v==crs_var: # type = auxiliary for a variable that contains coordinate data, but isn't a dimension in cube:dimensions. # For example, the values of the datacube might be provided in the projected coordinate reference system, # but the datacube could have a variable lon with dimensions (y, x), giving the longitude at each point.