I need to make a script that processes a NetCDF file that contains 3 days of hourly forecast data from the norwegian meteorological office.
-
The NetCDF file contains various data I need (Precipitation,Tmperature,Wind etc).
-
The NetCDF file is in a lambert projection while I will need to project it into WGS84 UTM 32N.
-
Also I will need to resample from 2.5km (forecast inputs) to 1km(output) grid cells.
-
I need to save it into the IDRISI format .rst
PROBLEM! The original NetCDF is HUGE, covering the whole of scandinavia + neighbouring countries. Thus I will need a system that processes quick.
I managed to do this already with ArcPy, but the process was too slow since for every hour timestep I needed to extract one by one the huge rasters, and only then could I clip them down.
Maybe in GDAL (in Python) there is a way to first clip at once the whole netcdf and then continue the processing with a smaller netcdf?
Best Answer
The Norwegian Met office has a THREDDS server at http://thredds.met.no/thredds/ so if you see the forecast you are trying to access there, you can extract just the subset you want from the OPeNDAP URL, which NetCDF4-Python treats like a local netcdf file.
For example:
produces this plot:
You could process the subset/subsample the data this way, or you could also use NCO tools to subset the OPeNDAP url:
From there you should either be able to use GDAL to convert or use the pyproj with the proj4 parameters included in the file to convert to whatever you need.