-
Notifications
You must be signed in to change notification settings - Fork 30
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
WMS with native grid #99
Comments
I believe that the issue here is that your data is not CF-compliant. From the CF standards: "When the horizontal spatial coordinate variables are not longitude and latitude, it is required that further information is provided to geo-locate the horizontal position. A grid mapping variable provides this information.". Currently there's nothing in your NetCDF file header that informs us what projection you're using. The usual thing to do is have a pair of 2d lat/lon co-ordinates, but I assume that's not possible? I know there are other ways of defining the projection with an additional variable as well, but I don't have much experience with this. What I can tell you with 100% certainty is that the message "No grids found in underlying NetCDF dataset" is coming directly from the Unidata NetCDF libraries (https://www.unidata.ucar.edu/software/netcdf-java/) which read the data. So ultimately there's nothing I can change in the code which will fix it (although I'm happy to help try to fix your data to solve the issue). |
Dear Sir As it looks from ncml, the data in the file is map projected. But the projection information is missing in this file. See grid_mapping in the CF conventions document. For different map projections supported in CF conventions see this link: https://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/build/apf.html Also see section 5.6 in the following link for how map projection information is packed in CF complaint netcdf files: Regards |
Could you point me real cases like the one from "Example 5.12. British National Grid + Newlyn Datum in CRS WKT format" ? Indeed my netcdf test file has missing metadata "grip_mapping" attribute and crs variable (what value for this int variable BTW). I really miss real cases examples. Will the WMS be available in this case, in other words will ncWMS will be able to digest and process those metadata ? I have set a test file with the grid_mapping attribute and the a crs variable: ncWMS will be able to process those metadata and deliver a WMS ? |
Dear Sir You are on the right path. Actually I tried to repair the g10.nc using ncml approach: https://docs.unidata.ucar.edu/thredds/ncml/2.2/ncml_cookbook.html I have picked up the projection parameters from: https://spatialreference.org/ref/epsg/32661/html/ In case the values of those projection parameters that you are using are different, you can modify the g10_repair.ncml. And CF complaint projection information for Polar Stereographic has been picked up from: https://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/build/apf.html See parameters in polar stereographic section. I have supplied them in the g10_repair.ncml Please note that, the false_easting and false_northing are in Kms which is not mentioned in CF convention document. Please rename g10_repair.ncml.txt to g10_repair.ncml. Actually github does not support .ncml files to be uploaded. THREDDS supports both netcdf and ncml files. And also the ncml that I provided can be directly injected into thredds for repairing the datasets. Also see the snapshot of the image in Unidata IDV (which uses NetCDF Java library, the same that is used by thredds and ncwms for reading netcdf files). There is a very good desktop tool available at unidata (toolsUI): There is good documentation for using toolsUI available here: https://docs.unidata.ucar.edu/netcdf-java/current/userguide/toolsui_ref.html You can go to the Feature Types Tab, within that go to Grids Tab. Let me know if you are facing any issue. regards. |
Thanks very much for helping Ghansham. Your return experience is very valuable. I have corrected directly my test file from a CDL file editing but I note the use of the ncml additionnal file. Here are the new header:
But the WMS is still not available: "No grids found in underlying NetCDF dataset" What do I have missed ? |
You've missed the fact that you can't just pick an arbitrary name for the grid mapping, you need to choose one from this list: https://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/build/apf.html Specifically, you need to choose However, in trying this out, I found a bug in ncWMS which means this doesn't display correctly (it incorrectly calculates the bounding box of the data, causing it to not display above latitudes of 39). I'll look into this at some point next week, but it's unlikely to work properly using THREDDS. Give it a try though and let me know how you get on |
Dear Sir @guygriffiths sir is absolutely correct. The "grid_mapping_name" attribute of the "crs" variable (in this case) must be "polar_stereographic". Rest everything seems correct. Please refer to the ncml that I shared in my previous post. Regards |
Thanks again on your interest on this topic. Here they are:
The WMS is available from https://thredds-su.ipsl.fr/thredds/wms/ipsl_thredds/brocksce/tmp/g15.nc?service=WMS&version=1.3.0&request=GetCapabilities The representation I get with a simple leaflet code is strange: See:
|
The representation you're getting with leaflet is cutting everything above the latitude of 39 off, because ncWMS thinks that's the limit of the dataset. The reason for that is that the Unidata library is incorrectly reporting back the lat/lon bounding box of the projected co-ordinate system. My best guess is that they are just checking the edges of the projected grid to determine the maximum available latitude. If we look at your leaflet plot, you can see that the centre of right-hand edge is the highest latitude point on the image perimeter. But of course in a polar projection, the actual highest latitude point is somewhere in the middle of the image. It's not a big deal to fix, and I should be able to make a new release of ncWMS next week. That won't update THREDDS as far as I'm aware, but you may be able to simply drop the new library in place of the old one on your Tomcat installation. |
Dear sir You should check the repair ncml that I sent for minimal amount of metadata required to correct your file. I think you haven't checked that. In the latest metadata that you posted has skipped semi_major and semi_minor axes. And EPSG_code is additional (not required). Regards |
Hi Ghansham, |
@PBrockmann - The data which is not working in leaflet, due to the ncWMS bug, may only not be buggy because leaflet works exclusively in EPSG:3857 and uses lat-lon. I suspect that if you actually make an EPSG:32661 request to ncWMS directly it may work. The fact that ncWMS is getting the incorrect lat-lon bounding box shouldn't come into play if we never translate into lat-lon (I'm not 100% certain on this, but I would definitely recommend trying it). |
For info the bug also appears in EPSG:32761
Indeed I could also describe the grid with latitudes, longitudes expressed in EPSG:4326 but my purpose is to explore if I can |
No, I think not until I publish a new version of ncWMS with the bug fixed, which will be next week sometime. |
Sir You have to follow CF conventions document. That what we follow. Regards |
Any new code to test on this issue ? |
Did you release a version somewhere with this fix? |
No, apologies but I haven't had time to work much on this. There is a snapshot release of the edal-cdm library which fixes this issue though. You can download it from https://github.com/Reading-eScience-Centre/edal-java/releases/tag/edal-1.5.3-SNAPSHOT and drop it in in place of edal-1.5.2.jar in the WEB-INF directory. |
Many thanks. I have tested and indeed the map appears but with gap. A "closing line" appears whereas there should not have any since there is no reprojection needed. I have used OpenLayers and the g14.nc file available from Code used: Other point, is the patch possible to be applied for the ncWMS code distributed from a Thredds server (ie code coming from the thredds.war) ? To test your correction I have copied edal-cdm-1.5.3-SNAPSHOT.jar to /usr/local/tomcat/webapps/ncWMS2/WEB-INF/lib/edal-cdm-1.5.2.jar. |
Tested with OpenLayers. Code used: Same closing problem. |
Any news on this issue ? |
Am I the only one to be interested to use WMS at native grids ? |
Hi, sorry but I'm not really actively working on this at the moment. I'm happy to review any PRs which fix the issue, but I don't have time to look into it myself. |
Ok could you tell me where to look at on this issue nearly corrected ? The last problem that remains is about non closing grid at the change date line that left some parts unplotted. |
Sure, I think the entry-point to start looking is the I would stick a breakpoint there and step through from that point to get to the issue. |
Is it possible that a Thredds server could deliver a WMS from a netCDF (CF compliant) that has only only projected coordinates (here they are in a North Polar Stereographic projection - EPSG:32661) ?
I have a test file available from : https://thredds-su.ipsl.fr/thredds/catalog/ipsl_thredds/brocksce/tmp/catalog.html?dataset=DatasetScanIPSLTHREDDS/brocksce/tmp/g10.nc
But I get for the WMS : "No grids found in underlying NetCDF dataset"
The netCDF header looks like this:
Here is a plot of the variable H from a cartopy python script:
The text was updated successfully, but these errors were encountered: