[ncl-talk] error in plot from data set of different number of grid points
Adam Phillips
asphilli at ucar.edu
Fri Dec 19 09:20:23 MST 2014
Hi Thomas,
Two quick notes:
1 - You can overlay fields that are on different grids using the overlay
function as it would not matter that your psl field has an extra latitude
line. I would recommend calling gsn_csm_vector_map and then gsn_csm_contour:
vres = True
vres at gsnDraw = False
vres at gsnFrame = False
.....
res = True
res at gsnDraw = False
res at gsnFrame = False
...
vmap = gsn_csm_vector_map(wks,ud,vd,vres)
omap = gsn_csm_contour(wks,psl,res)
overlay(vmap,omap)
draw(vmap)
frame(wks)
You may be able to use gsn_csm_vector_scalar_map as you are not coloring
the vectors by your scalar field so it shouldn't matter that the scalar
grid is different from your u/v grids, but I have never done that before.
2 - Dennis correctly pointed out that the output from printVarSummary shows
that there are no spatial coordinate variables (latitude/longitude)
associated with your 3 data arrays. Unless coordinate variable information
is provided NCL will not know how to plot the data. Both Dennis (for 1D
lats/lons) and Mary (for 2D lats/lons) provided suggestions on how to add
the necessary coordinate information to your data. Please read over their
emails if you have not attached your coordinate information to the data
directly (for 1D lats/lons) or through the resource lists (for 2D
lats/lons).
Hope that helps. If not, please respond to the ncl-talk email list.
Adam
On Thu, Dec 18, 2014 at 4:22 PM, tms_l <littithomas at gmail.com> wrote:
> hi,
>
> variable with dimension of lat=145 .the number of lat points is 145 in
> one variable..its not a typo.
> however, the other two variables (ud & vd) having number of points , lat
> =144..
>
> but the number of longitude points are same..I think this will also make
> an error..can i get any suggestion to deal with the data sets of different
> number of latitude points???ultimately , i would like to plot these three
> data sets together..
>
> thank you so much
>
>
>
> On Fri, Dec 19, 2014 at 1:19 AM, Dennis Shea <shea at ucar.edu> wrote:
>>
>> There are no coordinate variables associated with your variables.
>> How would NCL know where to plot values??
>>
>> For example
>>
>> printVarSummary(u)
>>
>> Variable: u
>> Type: float
>> Number of Dimensions: 2
>> Dimensions and sizes: [lat | 96] x [lon | 144]
>> Coordinates:
>> lat: [ -90..90] <===== These tell ncl where to ploat
>> lon: [ 0..357.5] <=====
>> Number Of Attributes: 3
>> units : m/s
>> long_name : Zonal wind
>>
>> =================
>> Are there lat/lon values available? If so, one approach would be
>>
>> u!0 = "lat"
>> u!1 = "lon"
>> u&lat = lat
>> u&lon = lon
>> printVarSummary(u)
>>
>> --
>> Also, the variable with dimension of lon=145 ... Does that have the
>> cyclic point
>> contained or was that a typo?
>>
>>
>> On Wed, Dec 17, 2014 at 5:17 PM, tms_l <littithomas at gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> I am plotting ud,vd & psl_clim using the following plot function .
>>>
>>> *plot=gsn_csm_vector_scalar_map(wks,ud,vd,psl_clim,res)*
>>>
>>> Variable: *ud*
>>> Type: float
>>> Total Size: 110592 bytes
>>> 27648 values
>>> Number of Dimensions: 2
>>> Dimensions and sizes: [144] x [192]
>>> Coordinates:
>>> Number Of Attributes: 1
>>> _FillValue : -1.073742e+09
>>>
>>>
>>> Variable: *vd*
>>> Type: float
>>> Total Size: 110592 bytes
>>> 27648 values
>>> Number of Dimensions: 2
>>> Dimensions and sizes: [144] x [192]
>>> Coordinates:
>>> Number Of Attributes: 1
>>> _FillValue : -1.073742e+09
>>>
>>>
>>> Variable: *psl_clim*
>>> Type: float
>>> Total Size: 111360 bytes
>>> 27840 values
>>> Number of Dimensions: 2
>>> Dimensions and sizes: [145] x [192]
>>> Coordinates:
>>> Number Of Attributes: 3
>>> long_name : MSLP(hPa)& wind-850hPa (a)
>>> _FillValue : 9.96921e+36
>>>
>>>
>>>
>>> Thanks in advance,
>>>
>>> Thomas
>>>
>>>
>>>
>>> On Thu, Dec 18, 2014 at 6:26 AM, Mary Haley <haley at ucar.edu> wrote:
>>>>
>>>> Hi Thomas,
>>>>
>>>> In order to plot data over a map, either as vectors or contours, you
>>>> have to provide latitude and longitude locations for your data.
>>>>
>>>> If you have a rectilinear grid, where the lat / lon are attached
>>>> directly to the data as 1-dimensional coordinate variables, then the
>>>> plotting routines will use these automatically.
>>>>
>>>> If you have 2-dimensional lat / lon coordinate points, then you either
>>>> need to attach these to your data as special "lat2d" / "lon2d" attributes,
>>>> or set the sfYArray / sfXArray resources.
>>>>
>>>> From your description, it sounds like you have a rectilinear grid, but
>>>> your data variable may not be constructed properly. The error message is
>>>> saying that it can't determine if you have valid lat / lon coordinate
>>>> variables, which can happen if your "units" attribute is not one of the
>>>> recognized values, like "degrees_north" or "degrees_east", and/or the
>>>> coordinate variables somehow got stripped off your data variable. This can
>>>> happen if you do a calculation on your data and put it in a new array,
>>>> causing the metadata to be stripped off.
>>>>
>>>> Please do a "printVarSummary" on the data variables you are trying to
>>>> plot, and send it back to ncl-talk so we can see what it looks like.
>>>>
>>>> Thanks,
>>>>
>>>> --Mary
>>>>
>>>>
>>>> On Tue, Dec 16, 2014 at 8:23 PM, tms_l <littithomas at gmail.com> wrote:
>>>>
>>>>> Dear ncl users
>>>>>
>>>>> I would like to plot u & v components of wind along with mean sea
>>>>> level pressure data.The wind data (time,level,lat_1,lon_1) is 4 dimensional
>>>>> and mean sea level pressure data (time,lat,lon) 3 dimensional.
>>>>>
>>>>> Also the number of grids points are arranged differently in each data
>>>>> sets.
>>>>>
>>>>> For wind data latitude , lat_1 = 144 points
>>>>> longitude , lon_1 =192 points
>>>>>
>>>>> For mean sea level pressure latitude , lat =145
>>>>> longitude, lon =192
>>>>>
>>>>> I am getting the error message as follows and the mean sea level
>>>>> pressure data seems to plotted reversely..Is there any function to deal
>>>>> with data sets of different grid points or how can solve this issue? Any
>>>>> help will be appreciated.
>>>>>
>>>>>
>>>>> error message :::::::
>>>>> (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'
>>>>> (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'
>>>>>
>>>>>
>>>>>
>>>>> Regards
>>>>>
>>>>> Thomas
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>
>>>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
--
Adam Phillips
Associate Scientist, Climate and Global Dynamics Division, NCAR
www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141219/cc3bc59c/attachment.html
More information about the ncl-talk
mailing list