[ncl-talk] Attaching coordinate information

Mary Haley haley at ucar.edu
Fri Dec 2 14:37:36 MST 2016


Barry,

In order to plot data over a map, you have to provide lat/lon information.
That's what the error is telling you.

Your script has a data variable called t2m_ave, and it doesn't have any
lat/lon coordinates associated with it. You did name the two dimensions
"lat" and "lon", but that's not enough. You additionally need to do this:

    t2m_ave!0="lat"
    t2m_ave!1="lon"
    t2m_ave&lat = lat_0
    t2m_ave&lon = lon_0
Here's another way you can get the lat/lon coordinates attached t2m_ave:

When you do an arithmetic calculation like this:

    t2m_ave = t2m/n_dirWRF

NCL does not copy any metadata from the right-hand variables, except for
the _FillValue attribute.

To preserve the metadata, you can do this little trick:

  t2m_ave = t2m                 ; This makes an identical copy of t2m
  t2m_ave = t2m/n_dirWRF

  printVarSumary(t2m_ave)

The printVarSummary will verify whether any metadata got copied.

--Mary



On Tue, Nov 29, 2016 at 9:24 AM, Barry Lynn <barry.h.lynn at gmail.com> wrote:

> Hi:
>
> I have used the helpful suggestions offered through ncl-talk to create
> the attached program that reads multiple GEFS files from multiple GEFS
> directories (on your disk).
>
> Of course, any one on the list can use this program, but I would like to
> upload it again after I solve this problem.
>
> As part of my calculations for the GEFS mean, I need to create a variable
> called t2m_ave.  However, when I use it I get get the error below.
>
> If I use a variable from the GEFS*grb files that I don't need in place of
> it, I can make very nice plots of the mean surface temperature. This means
> that these variables already have grid information attached to them.
>
> The page: http://www.ncl.ucar.edu/Document/Graphics/error_msg.shtml
>
> has a suggestion what to do, but I am not sure what "x" is, and how to use
> the suggestion.
>
> The upshot is that I need to attach geographical information to my
> "average variables," and I don't know how to do this.
>
> check_for_y_lat_coord: Warning: Data either does not contain a valid
> latitude coordinate array or doesn't contain one at all.
> (0) A valid latitude coordinate array should have a 'units' attribute
> equal to one of the following values:
> (0)    'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
> 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
> (0) check_for_lon_coord: Warning: Data either does not contain a valid
> longitude coordinate array or doesn't contain one at all.
> (0) A valid longitude coordinate array should have a 'units' attribute
> equal to one of the following values:
> (0)    'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
> 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg eas
> --
> Barry H. Lynn, Ph.D
> Senior Lecturer,
> The Institute of the Earth Science,
> The Hebrew University of Jerusalem,
> Givat Ram, Jerusalem 91904, Israel
> Tel: 972 547 231 170
> Fax: (972)-25662581
>
> C.E.O, Weather It Is, LTD
> Weather and Climate Focus
> http://weather-it-is.com
> Jerusalem, Israel
> Local: 02 930 9525
> Cell: 054 7 231 170
> Int-IS: x972 2 930 9525
> US 914 432 3108
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> 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/20161202/89033e40/attachment.html 


More information about the ncl-talk mailing list