On 9/16/23 09:37, Thomas Lavergne via QGIS-User wrote:
Since I am also a programmer, I tried to find where in the QGIS code the netCDF/CF 
geolocation is read and decoded, to see if there was a strict test on 
:units="m". But I failed to find this in the code.

Hi Thomas,

I'm a QGIS NetCDF user.

Let me start to say that you can open a netcdf file in QGIS both as a Raster 
and as a Mesh.
And 'netcdf' is a very broad definition with a lot of members, all to be 
handled/defined differently :-)

I think you are using the Mesh dialog, so the Mesh provider:
https://github.com/qgis/QGIS/tree/master/src/providers/mdal

Loading of the crs is done here:
https://github.com/qgis/QGIS/blob/master/src/providers/mdal/qgsmdalprovider.cpp#L493

BUT(!) the actual interpretation (the heavy lifting of all the different Mesh 
types) of the data is done using the MDAL library:
https://github.com/lutraconsulting/MDAL

There are a lot of different mesh data types which MDAL can handle:
https://github.com/lutraconsulting/MDAL/tree/master/mdal/frmts

And as said: all different netcdf flavours have their own handling:
CF files:
https://github.com/lutraconsulting/MDAL/blob/master/mdal/frmts/mdal_cf.hpp
Netcdf ugrids for example:
https://github.com/lutraconsulting/MDAL/blob/master/mdal/frmts/mdal_ugrid.cpp
etc

Not sure if this helps to find out who is to blame:
- the definition/quircks of the data   <= very often :-)
- QGIS
- MDAL

Since you are a programmer, you can try to create your own Netcdf files, for 
example with python
https://unidata.github.io/python-training/workshop/Bonus/netcdf-writing/
and try to create tiny nc files with your exact used dimensions and variables.
Then you can try to find out some scenario's and hopefully find out who is to 
'blame' :-)

(Maybe your actual question is better suited as an issue at the MDAL lib)

Regards,

Richard Duivenvoorde






_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to