Project

General

Profile

Merging grids

Added by Francis Rayder almost 11 years ago

I know that it is possible to split a dataset into different coordinate regions. For example, with

cdo sellonlatbox,180,-180,90,66 input.nc output.nc

I got only the northermost latitudes from a dataset, and with

cdo sellonlatbox,180,-180,66,33 input.nc output.nc

I got the latitudes further south, and so on. Now, my question is, is it possible to combine these split fields again? After I modify them indivually, I would like to put them back together again. I tried merge, but that only works for fields with different variables.


Replies (3)

RE: Merging grids - Added by Ralf Mueller almost 11 years ago

have you tested mergegrid?

The other option is the scatter-gather combination. I wanted to write an operator news feed for a long time, but didn't manage to do, yet. anyhow, the short answer is

  • scatter,n,m split regular fields in n x m parts and
  • gather is putting it all together again

here comes a litte example using the internal topography operator 'topo'

  • cdo -f nc -topo topo.nc
  • split in to 3x2 part with
    cdo -f nc scatter,3,2 topo.nc topo_scat
  • results:
    -rw-rw-r-- 1 ram users  173K Nov 13 15:52 topo_scat00005.nc
    -rw-rw-r-- 1 ram users  173K Nov 13 15:52 topo_scat00004.nc
    -rw-rw-r-- 1 ram users  173K Nov 13 15:52 topo_scat00003.nc
    -rw-rw-r-- 1 ram users  173K Nov 13 15:52 topo_scat00002.nc
    -rw-rw-r-- 1 ram users  173K Nov 13 15:52 topo_scat00001.nc
    -rw-rw-r-- 1 ram users  173K Nov 13 15:52 topo_scat00000.nc
    
  • now use cdo plotting operators
    for file in  topo_scat*nc; do cdo shaded,device=png -chname,topo,$file $file plot_$file; done
    with output
    -rw-rw-r-- 1 ram users   87K Nov 13 15:53 plot_topo_scat00000.nc_topo_scat00000.nc.png
    -rw-rw-r-- 1 ram users   94K Nov 13 15:53 plot_topo_scat00001.nc_topo_scat00001.nc.png
    -rw-rw-r-- 1 ram users   94K Nov 13 15:53 plot_topo_scat00002.nc_topo_scat00002.nc.png
    -rw-rw-r-- 1 ram users   88K Nov 13 15:53 plot_topo_scat00003.nc_topo_scat00003.nc.png
    -rw-rw-r-- 1 ram users   98K Nov 13 15:53 plot_topo_scat00004.nc_topo_scat00004.nc.png
    -rw-rw-r-- 1 ram users   88K Nov 13 15:53 plot_topo_scat00005.nc_topo_scat00005.nc.png
    
  • check files with you favourite image viewer

should look like this:

RE: Merging grids - Added by Francis Rayder almost 11 years ago

Thank you, mergegrid worked. Because that command is not documented in the pdf I have, I was not aware it existed.

RE: Merging grids - Added by Ralf Mueller almost 11 years ago

The html and pdf links at the wiki should always represent the latest documentation.

    (1-3/3)