Skip to content
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

Xarray: Add warning if lat/lon is assumed for projection #1065

Merged
merged 1 commit into from Jun 19, 2019

Conversation

zbruick
Copy link
Contributor

@zbruick zbruick commented Jun 18, 2019

Adds a simple warning that latitude_longitude projection is being assumed if no CRS is found and file has lat/lon variables.

Closes #1039.

@zbruick zbruick added this to the 0.11 milestone Jun 18, 2019
@@ -370,6 +370,8 @@ def parse_cf(self, varname=None, coordinates=None):
# If we found them, create a lat/lon projection as the crs coord
if has_lat and has_lon:
var.coords['crs'] = CFProjection({'grid_mapping_name': 'latitude_longitude'})
log.warning('Found lat/lon values, assuming latitude_longitude '
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention that we haven't already found a projection, like "No projection found but found lat/lon values"?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is already given with the warning that is issued when it doesn't find any valid projection details in the file, just above this part in the code.

try:
    proj_var = self._dataset.variables[proj_name]
    var = self._dataset.variables[proj_name]
except KeyError:
    log.warning('Could not find variable corresponding to the value of '
                'grid_mapping: {}'.format(proj_name))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So both warnings would show up if there isn't a CRS but lat/lon values exist - which I think would be the ideal message to users here. @dopplershift do you want any changes to this still?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nope, we're good.

@dopplershift dopplershift added Area: Xarray Pertains to xarray integration Type: Enhancement Enhancement to existing functionality labels Jun 19, 2019
@dopplershift
Copy link
Member

Test failures are just SkewT still.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Xarray Pertains to xarray integration Type: Enhancement Enhancement to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle missing latlon projection
3 participants