I have been trying to impot netcdf files following this guide online http://www.ggiuliani.ch/download/netcdf_qgis_GG.pdf into qgis 2.10 with no success. ALthough the file is imported, the dimensions are wrong and I am not sure how to assign lat/lon information to the selected var layer (eg temperature). I have tried plotting the grid in python using matplotlib and everything is fine with the file.
Asked
Active
Viewed 5,976 times
4
-
2I do not know much about netcdf files. But If you say that dimensions are wrong, it probably have something to do with the Coordinate System used. Are you sure that the coordinate system choosen is the correct one? Right-click the layer and use set layer CRS. – Alexandre Neto Oct 22 '15 at 15:54
-
yes. I set the same CRS as the file -- WGS84. It seems as if the problem is something to do with the fact the lat and lon info are not taken into account. The image plotted as top right corner coordinate 0,0 and its lenght width is determined by the number of columns and row inside the netcdf file (ie in my case the extent in the x direction is equal to the square root of the number of data points i have. Total of 100, so the extent is from 0 to 10 in the long dir and from 0,10 in the lat) – Jon Oct 22 '15 at 16:07
-
1yes. I set the same CRS as the file -- WGS84. It seems as if the problem is something to do with the fact the lat and lon fields are not taken into account when plotting the image. The image is plotted at the top right corner coordinate 0,0 and its lenght and width is determined by the number of columns and row inside the netcdf file and not by the values in the XLAT and XLON fileds in the netcdf file (ie in my case the extent in the x direction is equal to the square root of the number of data points i have. Total of 100, so the extent is from 0 to 10 in the long dir and from 0,10 in the lat) – Jon Oct 22 '15 at 16:12
-
is that a temperature-derived satellite image? if so, you'd need an extra file where long/lat information is stored, then you'd need to edit your header file in order to assign the long/lat information. – Gery Oct 22 '15 at 18:51
-
@Gery no its a simulation. But Ive tried with observational data as well and got the same result. its not file dependent it seems I have tried with in ArcGIS I can select the lat and long as extent wehn importing the file but I cannot see how in Qgis. Also if I try using the netCDF4 and matplotlib lib in python no problems but cannot see how to import them in qgis. I include an ncdump -h below – Jon Oct 22 '15 at 19:19
-
dimensions: Time = UNLIMITED ; // (1 currently) DateStrLen = 19 ; west_east = 78 ; south_north = 72 ; bottom_top = 39 ; bottom_top_stag = 40 ; soil_layers_stag = 4 ; west_east_stag = 79 ; south_north_stag = 73 ; variables: char Times(Time, DateStrLen) ; float XLAT(Time, south_north, west_east) ; XLAT:FieldType = 104 ; XLAT:MemoryOrder = "XY " ; XLAT:description = "LATITUDE, SOUTH IS NEGATIVE" ; XLAT:units = "degree_north" ; XLAT:stagger = "" ; – Jon Oct 22 '15 at 19:19
-
float XLONG(Time, south_north, west_east) ; XLONG:FieldType = 104 ; XLONG:MemoryOrder = "XY " ; XLONG:description = "LONGITUDE, WEST IS NEGATIVE" ; XLONG:units = "degree_east" ; XLONG:stagger = "" ; – Jon Oct 22 '15 at 19:20
-
Can you upload the file somewhere? – AndreJ Oct 23 '15 at 03:50
-
Have a look at: http://gis.stackexchange.com/questions/134617/how-to-match-a-raster-netcdf-data-with-a-vector-layer-in-qgis/134671# – BillW Jan 05 '16 at 04:55
-
GDAL (and so QGIS) can't deal with non-affine (regular) grids without resamping them. I'd suggest using GDAL directly rather than QGIS to see if gdalwarp can build a regular grid from your NetCDF, gdalwarp infile outfile.tif might be enough. That said, NetCDF is extremely general and pretty much nothing you've learnt necessarily applies to particular files. The GDAL model just doesn't extend generally enough for what this file format can be used for, so next choice is direct access with R or Python ... – mdsumner Jan 08 '18 at 12:08