[ncl-talk] Writing two dimensional lat and lon, respectively

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Mon Jan 19 13:45:50 MST 2015


Lisi,

Here is a generic method that makes an output file with 2-D coordinates
conforming to the CF conventions.  If WRF has different rules for 2-D
coordinate variables, ask the WRF help list.

Let f1 be your input file that includes 2-D coordinates, f2 be the output
file, and vout be an output array variable made by your program.  Let the
2-D coordinate variables be named lat and lon, for example, though they
could be named anything.

Your vout array should include the same geographic DIMENSION names as used
by the 2-D coordinates, for example X and Y.  vout must also have the same
*1-D* coordinate variables for X and Y, as used by the 2-D coordinates.

The 2-D coordinate variables must be copied explicitly, but this is quite
easy:

   f2->lat = f1->lat
   f2->lon = f1->lon

The only other thing needed for CF conformance is to attach a special
attribute to the output data array:

   f2->vout at coordinates = "lat lon"

See chapter 5 of the CF-1 conventions for details about 1-D and 2-D
coordinate variables:
http://cfconventions.org/Data/cf-conventions/cf-conventions-1.6/build/cf-conventions.html

--Dave

On Fri, Jan 16, 2015 at 1:36 PM, Lisi Pei <lisipei at msu.edu> wrote:

> Hi there,
>
> I am wandering about is there any method to write a .nc file with the
> coordinates like the standard WRF output variables in 2D for both lat and
> lon? When I am using NCL I always encounter this problem as it seems to
> only be capable in writing a 1D only coordinate with NCL. I used to do this
> by read in a WRF standard output nc file, and then replace certain
> variables with the data I processed, which helps keeping the original WRF
> 2D lat and lon without any extra effort in generating these 2D coordinate
> variable which I always had trouble with. But think there is probably a
> more decent way to do it and thank you in advance.
>
> Best Regards,
> Lisi
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150119/14933c39/attachment.html 


More information about the ncl-talk mailing list