-
Notifications
You must be signed in to change notification settings - Fork 4
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
QGIS and grid_mapping attribute #31
Comments
Hi, GDAL may still have problems properly interpreting cf-compliant metadata. As for Geomet, I remember that netcdf files generated by GIOPS-F could not be directly ingested into it for all sorts of reasons in the past. I am no longer up to date with such issues but will have to deliver netcdf files that Geomet is happy with in the coming weeks. https://wiki.cmc.ec.gc.ca/wiki/GeoMet_2/Data/netCDF https://gdal.org/drivers/raster/netcdf.html "Georeference There is no universal way of storing georeferencing in NetCDF files. The driver first tries to follow the CF-1 Convention from UNIDATA looking for the Metadata named “grid_mapping”. If “grid_mapping” is not present, the driver will try to find an lat/lon grid array to set geotransform array. The NetCDF driver verifies that the Lat/Lon array is equally space. If those 2 methods fail, NetCDF driver will try to read the following metadata directly and set up georeferencing. ... " |
Thanks @deacud . This page on the internal wiki is pretty old (2016!). GeoMet indeed leverages GDAL & PROJ to read input NetCDF files. The best way to test a NetCDF dataset is to provide a sample and we'll be glad to validate how it behaves. Thanks! |
I'm not very familiar with the To remove the "sfclevel" dimension, you could pass the argument |
For Sacha's case, regular lat-lon, 'grid_mapping' is necessary only if there is a need to specify the radius of the Earth. Otherwise, 'grid_mapping' could be removed. "A grid mapping variable may be referenced by a data variable in order to explicitly declare the coordinate reference system (CRS) used for the horizontal spatial coordinate values. For example, if the horizontal spatial coordinates are latitude and longitude, the grid mapping variable can be used to declare the figure of the earth (WGS84 ellipsoid, sphere, etc.) they are based on." "The grid_mapping variable may identify datums (such as the reference ellipsoid, the geoid or the prime meridian) for horizontal or vertical coordinates. Therefore a grid mapping variable may be needed when the coordinate variables for a horizontal grid are longitude and latitude. The grid_mapping_name of latitude_longitude should be used in this case." |
Thanks, Daniel and Michael: I am not sure how easy it is to add the command line option to remove grid_mapping, but I can still work around it by using ncatted from NCO and remove it after conversion. I thought maybe we (fstd2nc) needed to add more info to the longitude_latitude variable to make it work, that is mainly why this issue was created. If there is no other way but to remove the attribute, I can close the issue. It would not be a bad thing if qgis could recognize the projection, if possible) Cheers |
"GDAL is a great library and a lot of work has gone into it, but its netcdf support has always been sketchy . When I first was directed to it years ago, it could only do 2-D files, and would flip the data, even when the metadata clearly said the axes went in the other direction (it just ignored the metadata attributes). That problem lasted for a long time (for all I know it still does this). GDAL has had problems with greater than 3-D files, forecast files, DSG files, files that are part of the NCEI examples for sending in data, some issues with time, and some of the newer features in netcdf4 files." (December 2019) |
It turns out to be trivial to remove the |
It works when I remove |
I tried replicating on my end, but not getting any error message with my test data. From ppp4, what I ran was:
This gives me a variable with the attribute
It brings up the data without any obvious problems. @guziy, do you have a minimal working example of how to trigger the error? edit: or is the problem that it doesn't pop up with a CRS dialogue for the file? |
QGIS does open the file and shows the colors for data except in the lower right corner it says unknown CRS, so if you decide to use it along with shapefiles or other data, that might be problematic. My example file is here:
It is netcdf4 so you might want to use a newer qgis, from here for example:
Let me know if you need more info. |
Thanks. I was able to reproduce the same "Unknown CRS" message. Clicking on "Unknown CRS" pulls up a mini map with the correct region selected. Also, overlaying a shapefile seems to give the right results. Maybe "Unknown" is a misnomer, and means more like "user-specified projection"? For the default version of QGIS on ppp4 (2.18) says it has CRS of "USER:100000", and seems to work with a shapefile as well. I'm not familiar with GIS software... are there some other operations where this file fails to work? |
No, I don't think other operations will fail if the ones you mention work.. I was a bit surprised by the fact that if I add the grid_mapping attribute it becomes unknown, but if it is a misnomer, then I guess this issue is a false alarm... |
Out of curiosity, did the files end up working properly with QGIS in practical usage (beyond the quick checks that were done earlier)? Or is there further work needed to resolve this issue? |
Thanks Mike, actually the files were accepted by GeoMet team, so all should be fine. I will close the issue, please, feel free to re-open if needed. |
Hi:
I noticed that if a converted field has grid_mapping attribute, qgis does not recognise the CRS, but if from the same file and variable I remove the grid_mapping attribute, then the CRS/projection is recognized by qgis... It is important for Geomet to accept the netcdf files that the CRS is correctly recognized by the tools like QGIS or gdal.
Here are some metadata of my example file:
BTW is there a simple way to remove the sfclayer dimension during conversion?
The text was updated successfully, but these errors were encountered: