How to change longitude range in a NetCDF

前端 未结 2 719
北海茫月
北海茫月 2020-12-19 20:10

My NetCDF file has 4 dimensions (longitude, latitude, time, level pressure) and several variables.

I want to replace the longitude data which is [340 342 344 ... 36

相关标签:
2条回答
  • 2020-12-19 20:20

    This is what I found:

    ncap2 -O -s 'where(lon>180) lon=lon-360' ifile ofile
    

    I am not sure yet it doesn't change anything else but it seems work.

    0 讨论(0)
  • 2020-12-19 20:33

    I realise this is an old thread, but as I had a very similar problem recently I thought I'd add my solution as I didn't manage to find it elsewhere...

    I used the cdo package (https://code.zmaw.de/projects/cdo) command sellonlatbox to translate my input data from [0, 360) longitude range to be [-180, 180), and also reorder latitudes to be [-90, 90] (i.e. S -> N):

    cdo sellonlatbox,-180,180,-90,90 infile.nc outfile.nc
    
    0 讨论(0)
提交回复
热议问题