latitude-longitudenetcdfflipcdo-climatenco

invert latitude from -90,90 to 90,-90 in a netcdf file


I have the following netcdf file: ncfile.nc

The file has latitudes ranging from -90deg to 90deg.

I need to flip these coordinates to 90deg, -90deg, so that the southern hemisphere becomes the northern hemisphere and viceversa.

I tried with cdo invertlat but it does not work.

Any suggestion?


Solution

  • this works:

    ncap2 -s 'lat=-lat;' ncfile.nc out.nc 
    

    it multiplies the original latitude values by -1