Re: Cannot overlay vectors on a map properly

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Sep 12 2012 - 20:46:04 MDT

Keeping your current code just change

plot = gsn_csm_vector_map(wks,uwind(::4,::4),vwind(::4,::4),res)

to

plot = gsn_csm_vector_map(wks,uwind,vwind,res)

====================================
The reason for the error

You set:

   uwind@lat2d = lat2d ; (217,253)
   uwind@lon2d = lon2d

   vwind@lat2d = lat2d
   vwind@lon2d = lon2d

Then, in the plot you used

   uwind(::4,::4),vwind(::4,::4) ==> (55,64)

The @lat2d/lon2d are (217,253), the data (55,64). Hence, the mismatch.

---
You could use the following for consistency
   uwind = srf->u(0,2,::4,::4)
   vwind = srf->v(0,2,::4,::4)
   lat2d = srf->xlat(::4,::4)
   lon2d = srf->xlon(::4,::4)
   uwind@lat2d = lat2d
   uwind@lon2d = lon2d
   vwind@lat2d = lat2d
   vwind@lon2d = lon2d
On 9/12/12 7:22 PM, Almami Johnson wrote:
> Dear NCLers
>
> Anytime I try to plot a vector map using the script attached, I get the
> following error:
>
> (0)     is_valid_latlon2d_attr: Warning: The 'lat2d' attribute must
> either be the same dimension sizes as the data, or one element larger in
> both directions.  Your data will most likely not be overlaid on the map
> correctly.
> (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)     is_valid_latlon2d_attr: Warning: The 'lon2d' attribute must
> either be the same dimension sizes as the data, or one element larger in
> both directions.  Your data will most likely not be overlaid on the map
> correctly.
> (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 east'
>
>
> I have been searching in the website but could not find any solution.
> Could you help me to figure this out? The script is attached and here is
> what the output of the ncdump command looks like.
> Thanks.
>
>
>
>
> netcdf Africa_199908.MMEAN {
> dimensions:
>          x = 253 ;
>          y = 217 ;
>          plev = 13 ;
>          time = UNLIMITED ; // (1 currently)
> variables:
>          float xlon(y, x) ;
>                  xlon:long_name = "Longitude at cross points" ;
>                  xlon:units = "degrees_east" ;
>                  xlon:standard_name = "longitude" ;
>                  xlon:_CoordinateAxisType = "Lon" ;
>          float xlat(y, x) ;
>                  xlat:long_name = "Latitude at cross points" ;
>                  xlat:units = "degrees_north" ;
>                  xlat:standard_name = "latitude" ;
>                  xlat:_CoordinateAxisType = "Lat" ;
>          double plev(plev) ;
>                  plev:long_name = "Interpolated pressure" ;
>                  plev:units = "hPa" ;
>                  plev:axis = "Z" ;
>          double time(time) ;
>                  time:units = "hours since 1949-12-01 00:00:00" ;
>                  time:calendar = "standard" ;
>          float topo(y, x) ;
>                  topo:long_name = "Domain surface elevation" ;
>                  topo:standard_name = "surface_altitude" ;
>                  topo:units = "m" ;
>                  topo:coordinates = "xlon xlat" ;
>          float mask(y, x) ;
>                  mask:long_name = "Domain land/ocean mask" ;
>                  mask:standard_name = "landmask" ;
>                  mask:units = "1" ;
>                  mask:coordinates = "xlon xlat" ;
>          float ps(time, y, x) ;
>                  ps:long_name = "Surface pressure" ;
>                  ps:standard_name = "surface_air_pressure" ;
>                  ps:units = "hPa" ;
>                  ps:coordinates = "xlon xlat" ;
>                  ps:cell_methods = "time: point" ;
>          float u(time, plev, y, x) ;
>                  u:long_name = "U component (westerly) of wind" ;
>                  u:standard_name = "eastward_wind" ;
>                  u:units = "m s-1" ;
>                  u:coordinates = "xlon xlat" ;
>                  u:cell_methods = "time: point" ;
>          float v(time, plev, y, x) ;
>                  v:long_name = "V component (southerly) of wind" ;
>                  v:standard_name = "northward_wind" ;
>                  v:units = "m s-1" ;
>                  v:coordinates = "xlon xlat" ;
>                  v:cell_methods = "time: point" ;
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
>
>
> _______________________________________________
> 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 Wed Sep 12 20:46:18 2012

This archive was generated by hypermail 2.1.8 : Thu Sep 13 2012 - 14:22:31 MDT