TransWikia.com

Mapping a NetCDF in QGIS in the correct location on Earth

Geographic Information Systems Asked by Orla Osborne on December 27, 2020

I was wondering if anyone has encountered NetCDFs being mapped in the "wrong" location by QGIS? I’m using QGIS 3.16 and I’ve tried 2.18 too. I think the problem has to do with the longitude units of the NetCDF being in degrees east and QGIS not understanding how to deal with them properly. When I add other layers (vector or raster) they map correctly to my area of interest (British Columbia). My map display is set to WGS 84 (EPSG: 4326) and I import my file.nc as a mesh layer (I’ve tried raster too but it doesn’t make a difference) and set the CRS of the mesh layer to WGS 84 (4326) too after it has been imported. The NetCDF file imports and visualizes without any problems, it is just in the wrong place (i.e. it doesn’t appear anywhere near my study area. When I zoom into the mesh layer, The Coordinate box at the bottom of the display gives the longitude (degrees east, approx. 225), latitude (approx 50), and then when I zoom to a vector layer in my study area the coordinate box shows the longitude (approx.-128) and latitude (approx. 50).

I don’t think the problem lies with the NetCDF file as longitude degrees east are common, I think it is how QGIS is mapping it that may be the problem, like it doesn’t know how to convert the longitude degrees east.

The NetCDF has a single variable (Chlorophyll), with 4 dimensions (time, altitude, longitude and latitude). I downloaded it from https://coastwatch.pfeg.noaa.gov/erddap/griddap/erdMBchla1day.html using this bounding box: lat degrees north: 48, 55, lon degrees east: 227, 234

Also, I have tried mapping it in ArcGIS Pro, using the NetCDF to raster tool, and it works perfectly. Unfortunately, I need to be able to use it in QGIS as my ArcGIS Pro trial is about to expire.

I thought perhaps subtracting the longitude from 360 would solve the problem, so I used xarray to do so. QGIS crashed on trying to import this modified NetCDF so I assume that was not a good solution.

Any advice?

One Answer

This nc file does not store its CRS in itself. So I used OSGeo4W Shell with this command;

gdal_translate -a_srs EPSG:4326 -of netCDF erdMBchla1day_8453_6188_94d0.nc erdMBchla1day_8453_6188_94d0_4326.nc

enter image description here

Correct answer by Kazuhito on December 27, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP