Unidata/MetPy

Handle missing latlon projection

Closed this issue · 4 comments

Some data from TDS doesn’t include the LatLon_Projection variable listed for grid_mapping. While this isn’t CF compliant, it’d be simple enough to handle this one-off. In the case where this particular variable can’t be found, we could synthesize something appropriate.

Another option is to treat this like the case where no grid_mapping itself.

Just looked at the GFS data on the Thredds server used in the Q-vector example and it shows the LatLon_Projection value for grid_mapping. @kgoebber, was this the file that was giving you issues, or can you point me to a problematic one?

That was the file and the problem I was having was that I added a variable to the dataset without adding the pertinent coordinates and attribute information to make it work. With seeing the warning of 'Could not find variable corresponding to the value of grid_mapping: LatLon_Projection' I thought it was intrinsically linked to problems "reading" the projection. Instead the problem was I didn't properly name the coords. So I don't think there is an issue, but it might be good to add to the warning statement when it does move forward and is assuming lat/lon coordinates to help with reading warning/error messages.

Adding something to xarray.py around line 370:

log.warning('Found lat/lon values, assuming latitude_longitude '
            'for projection grid_mapping variable. ')

This will let the user know that it didn't completely fail and is proceeding under the assumed settings.

Thanks - made perfect sense. PR is in with this simple addition