lutraconsulting / qgis-crayfish-plugin

Plotting and manipulating mesh data in QGIS.
http://www.lutraconsulting.co.uk/products/crayfish/
Other
62 stars 24 forks source link

Strange values when loading a salinity nc file #346

Closed asierrl closed 6 years ago

asierrl commented 6 years ago

I've been trying to analyze a time-varying data set of ocean salinity, which I downloaded from the Copernicus web site (http://marine.copernicus.eu/services-portfolio/access-to-products/). The data are in nc format and comprise monthly means of ocean salinity at a 0.5 m depth for 15 years. When displaying it using Crayfish, the automatic minimum and maximum values provided by the Display Contours panel are -19990.000 and 19725.000. Loading it with NetCDF Browser shows the proper data range, from 34.1244 to 35.5312. I've been fighting to try to figure out what's going on but I don't have a clue. It seems, though, this is some kind of bug. Best regards, Asier

saberraz commented 6 years ago

hi @asierrl I had a quick look at the data. If I run gdalinfo on the netcdf, it comes up with some scaling and offset parameters in the header:

Band 3 Block=1440x1 Type=Int16, ColorInterp=Undefined
  NoData Value=32767
  Unit Type: 0.001
  Offset: 20,   Scale:0.001
  Metadata:
    add_offset=20
    long_name=salinity

I think Crayfish does not process those properly.

asierrl commented 6 years ago

Thanks a lot, saberraz. Then, if I understand proerly, it would be enough with using the field calculator within Crayfish and calculate the correct values as 20+value/1000. Best regards, Asier

asierrl commented 6 years ago

I tried and values seem to be correct, now. However I found a spatial discrepancy betwen the display of Crayfish and that of NetCDF Browser. The former seems to be using a lower resolution and loosing those pixels by the coast. I provide an example image in the following link:

enebada.eu/documentos_publicos/Crayfish_vs_NetCDF.png

The map loaded with NetCDF Browser is in a gray palette, while that of Crayfish is in a colour palette.

saberraz commented 6 years ago

Crayfish for QGIS 2.18 is using its own renderer library. But in 3.4 we are incorporating it within core QGIS so, hopefully, those discrepancies will not be present.

PeterPetrik commented 6 years ago

From Crayfish 3.x release and QGIS 3.4 release, the rendering and styling is implemented in QGIS Core. Data reading and support is implemented in MDAL. Please reopen the ticket in QGIS bug tracker for rendering issues or MDAL for format support issues. Thanks.