Is there a way to crop a NETCDF file?

前端 未结 3 649
盖世英雄少女心
盖世英雄少女心 2021-02-09 02:55

Imagine that you have a file example.nc, that has wind data defined in 90N, 90S, 180E, 180W region. Is there anyway I could in linux, with a simple nc-type command

3条回答
  •  离开以前
    2021-02-09 03:31

    NCO works fine, but just to list an alternative, one can also do it using cdo (climate data operators), which I find easier to remember. You can specify directly the longitude and latitude values in this way:

    cdo sellonlatbox,lon1,lon2,lat1,lat2 infile.nc outfile.nc
    

    where lon1,lon2,lat1,lat2 define the boundaries of the area you require. If you don't have it already installed you can get it on Ubuntu with

    sudo apt-get install cdo
    

    cdo has many other functions for processing, combining and splitting files and an excellent online documentation.

    Note that for CDO to work the coordinate variables (lat/lon) need to be defined according to CF conventions, so in that way the NCO solution is more robust (see the comments).

提交回复
热议问题