Re: errors when plotting grib files

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Jun 09 2011 - 15:25:58 MDT

Hi Yingli,

Your data doesn't have 1D coordinate arrays, which is where the error is coming from. NCL needs to know what the lat/lon coordinates are of your data, in order to overlay it on a map correctly. It first looks for 1D coordinate arrays, and if it can't find them, it complains.

If you do a printVarSummary on "prep", you will see this:

Variable: prep
Type: float
Total Size: 4083200 bytes
            1020800 values
Number of Dimensions: 2
Dimensions and sizes: [gridx_240 | 880] x [gridy_240 | 1160]
Coordinates:
Number Of Attributes: 13
  center : US National Weather Service - NCEP (WMC)
  long_name : Total precipitation
  units : kg/m^2
  _FillValue : 1e+20
  coordinates : gridlat_240 gridlon_240
. . .

Note the attribute "coordinates". This indicates that the variables "gridlat_240" and "gridlon_240" represent the lat/lon values on your file. You will need to read these in and set the special resources "sfXArray" and "sfYArray" equal to them:

  gridlon = fall[0]->gridlon_240
  gridlat = fall[0]->gridlat_240
. . .
  res@sfXArray = gridlon
  res@sfYArray = gridlat

---
FYI, you created a resource list via the "res" variable, but then when you called gsn_csm_contour_map, you set the third argument to "False" instead of passing in "res", so none of your plot options will take effect.
Please see an attached modification of your script, and the resultant image.
--Mary



On Jun 9, 2011, at 2:50 PM, yingli zhu wrote:

> Hi,
> I want to plot girb format files, but I get errors below:
>
> (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.
> (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'
>
> The data is <gag4.20000302.12>
> The scripts I use is <prep_1h.ncl>
> Any help is appreciated.
> Yingli_______________________________________________
> 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

1_Hour_Precipitation.png
Received on Thu Jun 9 15:26:12 2011

This archive was generated by hypermail 2.1.8 : Mon Jun 13 2011 - 09:37:43 MDT