Re: Switching longitude convention in a netcdf

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Tue Apr 29 2014 - 14:42:21 MDT

Hi Kevin,
Sorry for the delay in answering this question.

ncl_convert2nc does not have any capability for modifying the data or the coordinates, although it does have options whether you want to keep single element dimensions.

However, it is not too hard to create an NCL script to do this operation yourself (especially if the lat/lon coordinates are 1D).
I am attaching such a script here. You will need to modify it with the name of your file. Of course it could be generalized to operate on multiple files if you add in a loop, or you could use
NCL command line arguments to specify a file on the command line. See http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclCLO.shtml

Hope this helps.
 -dave

On Apr 17, 2014, at 11:13 AM, "HAVENER, KEVIN F GS-12 USAF AFWA 14 WS/WXED" <kevin.havener@us.af.mil> wrote:

> I have a grib1 file whose longitudes range from 0-360, is it possible to ncl_convert2nc the file to create a netcdf file whose longitudes range from -180 to 180? I've found a solution for grib2 but not grib1.
>
> Background: Wesley Ebisuzaki has patched (not released yet) his netcdf converter in wgrib2 to properly create netcdf files with a monotonically increasing longitude ranging from -180 to +180. Before his patch, his regridding function must have just mathematically subtracted 360 for longitudes greater than 180 leaving the variable data intact (not moving it within the file). Converting that file to netcdf resulted in a file organized from 0 to +180/-180 to 0 which breaks netcdf specs. He fixed that and the data gets properly reordered along with the coordinate conversion. Now I'm trying to figure out how to do the same for grib1 files. Wesley's original wgrib doesn't do netcdf conversions, so can ncl do it? Or is there some other way to manipulate the grib1 file first that I'm not aware of?
>
> Pardon this if the question has already been asked before, but I can't seem to search the archives.
>
> Kevin Havener
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Tue Apr 29 14:42:36 2014

This archive was generated by hypermail 2.1.8 : Sun May 04 2014 - 12:38:56 MDT