Re: Error: Data either does not contain a valid latitude coordinate array or doesn't contain one at all

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Dec 07 2009 - 08:00:18 MST

Hi,

In order to overlay data on a map, NCL needs to know the lat/lon
coordinates of your data.

The error message is occuring because your "mag" variable doesn't
have any lat/lon information associated with it.

There are several ways to associate lat/lon data with "mag". I'll
show you three of them.

The easy, but potentially expensive way, is to do a variable-to-
variable copy, which also copies the lat/lon information:

   mag = u ; Copies u's metadata to mag
   mag = sqrt(u^2+v^2)

A second way you can do it, since you've already read "lat" and "lon"
off the file:

   mag = sqrt(u^2+v^2)
   mag!0 = "lat"
   mag!1 = "lon"
   mag&lat= lat
   mag&lon= lon

The third way is to use the "copy_VarCoords" procedure in $NCARG_ROOT/
lib/ncarg/nclscripts/csm/contributed.ncl:

   mag = sqrt(u^2+v^2)
   copy_VarCoords(u,mag)

If you are ever not sure if a variable has lat/lon information
attached to it, you can use "printVarSummary" to print out
information about a variable:

    printVarSummary(mag)

This will indicate what attributes, named dimensions, and coordinate
arrays a variable has, if any.

--Mary

On Dec 7, 2009, at 3:03 AM, Wee-Beng Tay wrote:

> Hi,
>
> I am now trying to modify some examples. I would like to obtain
> something like the example on Mollweide projection "proj_1.ncl.
>
> However, instead of temperature, I would like to have velocity u,v
> instead. The color contour will be the magnitude of the velocity.
> So now I'm using gsn_csm_vector_scalar_map instead.
>
> Basically, what I have changed are:
>
> u = a->U(0,0,0:63:8,0:127:8) ; read velocity
> v = a->V(0,0,0:63:8,0:127:8)
> lat = a->lat
> lon = a->lon
> mag = sqrt(u^2+v^2) ;calculate magnitude
>
> contour = gsn_csm_vector_scalar_map(wks,u,v,mag,res) ; create
> the plot
>
> There's some other changes but they are minor ones.
>
> I keep getting the error:
>
> (0) 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.
>
> However, looking inside the atmos.nc file, there's clearly the lat
> and lon variables. Can someone enlighten me?
>
> Thanks alot!
>
> _______________________________________________
> 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 Mon Dec 7 08:00:38 2009

This archive was generated by hypermail 2.1.8 : Mon Dec 07 2009 - 16:12:30 MST