How to generate climate data
xxjjyy69 opened this issue · 1 comments
Hi,
I want to generate my own climate input data of different tile in nc4 file form like clim_0004_0053.tile.nc4, how could I do?
Now I have global climate nc data generated by global climate model.
If you already have everything merged as global data, what I would do is write a shell script that uses nco to split the data into tiles. We use tiles sized 2x2 degrees. In the file clim_0040_0060.tile.nc4, 0040 is the lat index, and 0060 in the lon index.
Within the shell script you can calculate the bounds of the tile with something like this:
lat0=90
lon0=-180
latdelta=2
londelta=2
latidx=0040
lonidx=0060
latstart=$(printf "%.10f" $(echo "scale=5; $lat0-$latidx*$latdelta" | bc))
latend=$(printf "%.10f" $(echo "scale=5; $latstart+$latdelta" | bc))
lonstart=$(printf "%.10f" $(echo "scale=5; $lon0+($lonidx-1)*$londelta" | bc))
lonend=$(printf "%.10f" $(echo "scale=5; $lonstart+$londelta" | bc))
Then run nco to get a subset of the global file
ncks -h -d lat,$latstart,$latend -d lon,$lonstart,$lonend global.nc4 tile_0040_0060.tile.nc4