5

When I load a raster layer with humidity data from NOAA database (for instance rhum.2m.2014.nc at ftp://ftp.cdc.noaa.gov/Datasets/NARR/Dailies/monolevel/) I am not able to match it with a simple map of the US counties (https://www.census.gov/geo/maps-data/data/cbf/cbf_counties.html).

I tried to give them both the same CSR but it does not work, it seems that the raster layer is a lot smaller than the US map.

Does anyone have any idea? I have been working on this issue for several days now...

NB: The raster file is a netcdf

NB2: With arcGIS the two maps match automatically but unfortunately I have to work with QGIS.

  • How are you 'giving' them both the same CRS? Note there is a difference between assigning a CRS and projecting to a CRS. You might want to take a look at this page Regarding the projection of those netcdf files. – Chris W Feb 16 '15 at 23:15
  • Thank you Chris for your answer. My issue is that when I used the projection tool my pixels value (humidity rate) are changing ! In the original scale it is a value between 0 and 100 but once i applied a projection I have strange values between -30,000 and -20,000... Any idea? – Sébastien Feb 16 '15 at 23:20
6

The metadata of the netcdf file includes projection information, which can be identified by QGIS as a custom CRS:

+proj=lcc +lat_1=50 +lat_2=50 +lat_0=50 +lon_0=-107 +x_0=5632642.22547 +y_0=4612545.65137 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs

but there is no extent given in projection units, only latlon for the corners.

If you run gdalinfo on the file, you see that subdatasets 1 and 2 contain lat and lon values for every cell, while subdataset 4 contains the humidity values you want. So you can use gdalwarp to extract those values, using the latlon information with the -geoloc option:

gdalwarp -geoloc NETCDF:"rhum.2m.2014.nc":rhum out.tif

You will get a warning that the metatdata will be cut off, because it is too long. The reprojection takes some time, because there are 365 bands in the file (one for every day).

The result can be loaded into QGIS as WGS84:

enter image description here

In the original lcc projection, it looks like this:

enter image description here

You have to add 0 as additional NODATA value, then you can set the style to grayscale for band 1 (January 1st), with extents between -30078 and -20809. The metadata information for the band tells you:

  rhum#_FillValue=-32767
  rhum#actual_range={2.2000084,100.02001}
  rhum#add_offset=307.66
  rhum#missing_value=32766
  rhum#scale_factor=0.0099999998
  rhum#units=%
  rhum#unpacked_valid_range={-20,120}
  rhum#valid_range={-32766,-18766}

So if you apply the scale factor and add_offset, the actual values are between 6.88% and 99.57%.

If you prefer to work in the original projection, you can reproject the corner coordinates from the metadata to lcc, add/subtract half the cellsize and use:

gdal_translate -a_ullr -32332 8989437 11308632 8160 NETCDF:"rhum
.2m.2014.nc":rhum rhumlcc.tif

This is not as exact as the geoloc method, because they are not using the exact lcc projection. This time I used pseudocolour on band 1:

enter image description here

  • Thank you so much, this is really helpfull and well explained ! – Sébastien Feb 17 '15 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.