I would like to extract CRU precipitation data in netcdf format into separate GeoTIFF files. Usually if the netcdf file only have variables: lon
, lat
, time
and pre
I can manage to extract it using below script:
for t in `cdo showdate input.nc`; do
cdo seldate,$t input.nc dummy.nc
gdal_translate -of GTiff -a_ullr <top_left_lon> <top_left_lat> <bottom_right_lon> <bottom_right_lat> -a_srs EPSG:4326 dummy.nc $t.tif
done
The CRU precipitation data have variables: lon
, lat
, time
, pre
and stn
I can't use above script because it contains 2 subdataset, got message from CDO: Input file contains subdatasets. Please, select one of them for reading.
How to select pre
variables in CDO and applying into above script?