-
Notifications
You must be signed in to change notification settings - Fork 4
DAS-2278 - Handle spatial subsetting in products with all fills in lat/lon coordinates #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
dc28ad8
7b581ec
70ac694
2296395
8fb7cf6
e0b43b6
7d5e34c
a43c291
1b23ebd
2443ed8
5a02020
69fbe69
beb8658
56d64a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.1.3 | ||
1.1.4 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"Identification": "hoss_config", | ||
"Version": 20, | ||
"Version": 21, | ||
"CollectionShortNamePath": [ | ||
"/HDF5_GLOBAL/short_name", | ||
"/NC_GLOBAL/short_name", | ||
|
@@ -119,13 +119,27 @@ | |
{ | ||
"Applicability": { | ||
"Mission": "SMAP", | ||
"ShortNamePath": "SPL3FT(P|P_E)", | ||
"VariablePattern": "(?i).*polar.*" | ||
"ShortNamePath": "SPL3FTP", | ||
"VariablePattern": "/Freeze_Thaw_Retrieval_Data_Polar/.*" | ||
}, | ||
"Attributes": [ | ||
{ | ||
"Name": "grid_mapping", | ||
"Value": "/EASE2_polar_projection" | ||
"Value": "/EASE2_polar_projection_36km" | ||
} | ||
], | ||
"_Description": "SMAP L3 collections omit polar grid mapping information" | ||
}, | ||
{ | ||
"Applicability": { | ||
"Mission": "SMAP", | ||
"ShortNamePath": "SPL3FTP_E", | ||
"VariablePattern": "/Freeze_Thaw_Retrieval_Data_Polar/.*" | ||
}, | ||
"Attributes": [ | ||
{ | ||
"Name": "grid_mapping", | ||
"Value": "/EASE2_polar_projection_9km" | ||
} | ||
], | ||
"_Description": "SMAP L3 collections omit polar grid mapping information" | ||
|
@@ -134,7 +148,7 @@ | |
"Applicability": { | ||
"Mission": "SMAP", | ||
"ShortNamePath": "SPL3SMP_E", | ||
"VariablePattern": "Soil_Moisture_Retrieval_Data_(A|P)M/.*" | ||
"VariablePattern": "/Soil_Moisture_Retrieval_Data_(A|P)M/.*" | ||
}, | ||
"Attributes": [ | ||
{ | ||
|
@@ -148,12 +162,12 @@ | |
"Applicability": { | ||
"Mission": "SMAP", | ||
"ShortNamePath": "SPL3SMP_E", | ||
"VariablePattern": "Soil_Moisture_Retrieval_Data_Polar_(A|P)M/.*" | ||
"VariablePattern": "/Soil_Moisture_Retrieval_Data_Polar_(A|P)M/.*" | ||
}, | ||
"Attributes": [ | ||
{ | ||
"Name": "grid_mapping", | ||
"Value": "/EASE2_polar_projection" | ||
"Value": "/EASE2_polar_projection_9km" | ||
} | ||
], | ||
"_Description": "SMAP L3 collections omit polar grid mapping information" | ||
|
@@ -166,15 +180,15 @@ | |
"Attributes": [ | ||
{ | ||
"Name": "grid_mapping", | ||
"Value": "/EASE2_polar_projection" | ||
"Value": "/EASE2_polar_projection_3km" | ||
} | ||
], | ||
"_Description": "SMAP L3 collections omit polar grid mapping information" | ||
}, | ||
{ | ||
"Applicability": { | ||
"Mission": "SMAP", | ||
"ShortNamePath": "SPL3SM(P|A|AP)|SPL2SMAP_S" | ||
"ShortNamePath": "SPL3SM(P|A|AP)$|SPL2SMAP_S" | ||
}, | ||
"Attributes": [ | ||
{ | ||
|
@@ -217,8 +231,76 @@ | |
{ | ||
"Applicability": { | ||
"Mission": "SMAP", | ||
"ShortNamePath": "SPL3FT(A|P|P_E)|SPL3SM(P|P_E|A|AP)|SPL2SMAP_S", | ||
"VariablePattern": "/EASE2_polar_projection" | ||
"ShortNamePath": "SPL3FTA", | ||
"VariablePattern": "/EASE2_polar_projection_3km" | ||
}, | ||
"Attributes": [ | ||
{ | ||
"Name": "grid_mapping_name", | ||
"Value": "lambert_azimuthal_equal_area" | ||
}, | ||
{ | ||
"Name": "longitude_of_projection_origin", | ||
"Value": 0.0 | ||
}, | ||
{ | ||
"Name": "latitude_of_projection_origin", | ||
"Value": 90.0 | ||
}, | ||
{ | ||
"Name": "false_easting", | ||
"Value": 0.0 | ||
}, | ||
{ | ||
"Name": "false_northing", | ||
"Value": 0.0 | ||
}, | ||
{ | ||
"Name": "master_geotransform", | ||
"Value": [-9000000, 3000, 0, 9000000, 0, -3000] | ||
} | ||
], | ||
"_Description": "Provide missing polar grid mapping attributes for SMAP L3 collections." | ||
}, | ||
{ | ||
"Applicability": { | ||
"Mission": "SMAP", | ||
"ShortNamePath": "SPL3FTP_E|SPL3SMP_E", | ||
"VariablePattern": "/EASE2_polar_projection_9km" | ||
}, | ||
"Attributes": [ | ||
{ | ||
"Name": "grid_mapping_name", | ||
"Value": "lambert_azimuthal_equal_area" | ||
}, | ||
{ | ||
"Name": "longitude_of_projection_origin", | ||
"Value": 0.0 | ||
}, | ||
{ | ||
"Name": "latitude_of_projection_origin", | ||
"Value": 90.0 | ||
}, | ||
{ | ||
"Name": "false_easting", | ||
"Value": 0.0 | ||
}, | ||
{ | ||
"Name": "false_northing", | ||
"Value": 0.0 | ||
}, | ||
{ | ||
"Name": "master_geotransform", | ||
"Value": [-9000000, 9000, 0, 9000000, 0, -9000] | ||
} | ||
], | ||
"_Description": "Provide missing polar grid mapping attributes for SMAP L3 collections." | ||
}, | ||
{ | ||
"Applicability": { | ||
"Mission": "SMAP", | ||
"ShortNamePath": "SPL3FTP", | ||
"VariablePattern": "/EASE2_polar_projection_36km" | ||
}, | ||
"Attributes": [ | ||
{ | ||
|
@@ -240,6 +322,10 @@ | |
{ | ||
"Name": "false_northing", | ||
"Value": 0.0 | ||
}, | ||
{ | ||
"Name": "master_geotransform", | ||
"Value": [-9000000, 36000, 0, 9000000, 0, -36000] | ||
} | ||
], | ||
"_Description": "Provide missing polar grid mapping attributes for SMAP L3 collections." | ||
|
@@ -318,7 +404,7 @@ | |
"Applicability": { | ||
"Mission": "SMAP", | ||
"ShortNamePath": "SPL3FT(A|P|P_E)", | ||
"VariablePattern": "^/Freeze_Thaw_Retrieval_Data(?:_(Global|Polar))/(transition_direction$|transition_state_flag$)" | ||
"VariablePattern": "^/Freeze_Thaw_Retrieval_Data(?:_(Global|Polar))?/(transition_direction$|transition_state_flag$)" | ||
}, | ||
"Attributes": [ | ||
{ | ||
|
@@ -332,7 +418,7 @@ | |
"Applicability": { | ||
"Mission": "SMAP", | ||
"ShortNamePath": "SPL3FT(A|P|P_E)", | ||
"VariablePattern": "^/Freeze_Thaw_Retrieval_Data(?:_(Global|Polar))/((?!transition_state_flag$)(?!transition_direction$).)*$|/Radar_Data/.*" | ||
"VariablePattern": "^/Freeze_Thaw_Retrieval_Data(?:_(Global|Polar))?/((?!transition_state_flag$)(?!transition_direction$).)*$|/Radar_Data/.*" | ||
}, | ||
"Attributes": [ | ||
{ | ||
|
@@ -526,7 +612,7 @@ | |
{ | ||
"Applicability": { | ||
"Mission": "ICESat2", | ||
"ShortNamePath": "ATL0[3-9]|ATL1[023]", | ||
"ShortNamePath": "ATL03", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for making this change |
||
"VariablePattern": "/gt[123][lr]/geolocation/.*" | ||
}, | ||
"Attributes": [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,9 +41,16 @@ | |
|
||
|
||
def get_variable_crs(variable: str, varinfo: VarInfoFromDmr) -> CRS: | ||
"""Retrieves the grid mapping variable metadata attributes for a given | ||
variable and creates a `pyproj.CRS` object from the grid mapping attributes. | ||
|
||
""" | ||
return CRS.from_cf(get_grid_mapping_attributes(variable, varinfo)) | ||
|
||
|
||
def get_grid_mapping_attributes(variable: str, varinfo: VarInfoFromDmr) -> Dict: | ||
"""Check the metadata attributes for the variable to find the associated | ||
grid mapping variable. Create a `pyproj.CRS` object from the grid | ||
mapping variable metadata attributes. | ||
grid mapping variable. | ||
|
||
All metadata attributes that contain references from one variable to | ||
another are stored in the `Variable.references` dictionary attribute | ||
|
@@ -66,11 +73,11 @@ def get_variable_crs(variable: str, varinfo: VarInfoFromDmr) -> CRS: | |
if grid_mapping_variable is not None: | ||
cf_attributes = grid_mapping_variable.attributes | ||
else: | ||
# check for any overrides | ||
# check for configuration provided attributes | ||
cf_attributes = varinfo.get_missing_variable_attributes(grid_mapping) | ||
D-Auty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if cf_attributes: | ||
crs = CRS.from_cf(cf_attributes) | ||
return cf_attributes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was looking at this and going to complain that the complexity is a little out of hand, but I see that none of it was you... So this seem fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a thought for optimization if grid_mapping_variable.attributes and varinfo.get_missing_variable_attributes() always return value
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks fine now. |
||
else: | ||
raise MissingGridMappingVariable(grid_mapping, variable) | ||
|
||
|
@@ -80,7 +87,18 @@ def get_variable_crs(variable: str, varinfo: VarInfoFromDmr) -> CRS: | |
else: | ||
raise MissingGridMappingMetadata(variable) | ||
|
||
return crs | ||
|
||
def get_master_geotransform( | ||
variable: str, varinfo: VarInfoFromDmr | ||
) -> Optional[List[int]]: | ||
"""Retrieves the `master_geotransform` attribute from the grid mapping | ||
attributes of the given variable. If the `master_geotransform` attribute | ||
doesn't exist, a `None` value will be returned. | ||
|
||
""" | ||
return get_grid_mapping_attributes(variable, varinfo).get( | ||
"master_geotransform", None | ||
) | ||
|
||
|
||
def get_projected_x_y_variables( | ||
|
Uh oh!
There was an error while loading. Please reload this page.