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?
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?
Share Improve this question edited Feb 9 at 9:25 aaaaa asked Feb 6 at 20:39 aaaaaaaaaa 1832 gold badges20 silver badges48 bronze badges 4 |2 Answers
Reset to default 2The answer from @aaaaa may work, though I cannot see quite how it reorders the values. I suggest a hybrid of that and Adrian's answer:
ncap2 -s 'lat=-lat;' in.nc temp.nc # Change [-90,0] to [90,0]
ncpdq --reorder=-lat temp.nc out.nc # Reverse [90,0] to [0,90]
Documentation is here.
The form give by Adrian @ClimateUnboxed above will reverse the latitudes so they go from 0 to -90, but only for the lat coordinate, which it places alone in the output file. And the values will still be [0,-90], not [0,90] as desired.
this works:
ncap2 -s 'lat=-lat;' ncfile.nc out.nc
it multiplies the original latitude values by -1
ncdfCF
, perhaps you should return to the warm embrace of R and give it a try? – Patrick Commented Feb 7 at 18:13