Hi Lawrence,
I see the problem with your original script!!! :-)
tera = tera_in(longitude|:,latitude|:,levelist|:)
:
plot = gsn_csm_contour_map_ce(wks, tera(:,:,0), res )
=======
It seems not documented [surprisingly] but the gsn_csm_contour_map*
expect the rightmost dimensions passed to the plot
function to be (latitude,longitude). You have
(longitude,latitude). I believe the function was
seeing "degrees_east" when it was looking for
"degrees_north" .....
See attached script ... modified version of your original
=======
Tip1: When doing reordering do not do it when reading from the file.
This can be very inefficient because NCL is actually making
multiple calls to the underlying netCDF software.
It is better to reorder in a separate step. This is done
in memory via a C/system call "memcpy" [or some such thing]
tera_in = short2flt(file1->t(0,12:22,::-1,:)) ; inefficient
better
tera_in = short2flt(file1->t(0,12:22,:,:)) ; efficient
tera_in = tera_in(:,::-1,:) ; reverse lat order
Tip2: This is personal. When you have coordinate arrays and you
want to subset, I think it is clearer and more robust
to use coordinate array sunscripting [ {..,} ] to
subset/select the data
eg:
levTop = 200
levBot = 1000
tera = short2flt( file1->t(:,{levTop:levBot},:,:) )
LEV = 850
res_at_gsnCenterString = LEV + "mb"
plot = gsn_csm_contour_map_ce(wks, tera(nt,{LEV},:,:), res )
good luck
D
On Thu, 1 Feb 2007, Lawrence wrote:
> Hi NCL users,
>
> I encounted a strange problem today, when I reorder the
> coordinates before draw the plots, I allways get the following warning
> 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'
>
> My code is something like this:
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> begin
> file1 = addfile("/data/ERA40/t_jja_mean.nc","r")
> tera_in = short2flt(file1->t(0,12:22,::-1,:))
> tera = tera_in(longitude|:,latitude|:,levelist|:)
> wks = gsn_open_wks("x11" ,"plot1")
> gsn_define_colormap(wks,"testcmap")
> res = True
> res_at_cnFillOn = True
> res_at_gsnSpreadColors = True
> res_at_mpCenterLonF = 180
> plot = gsn_csm_contour_map_ce(wks, tera(:,:,0), res )
> end
>
> I tried to use "printVarSummary(tera&longitude)" and got hte following:
>
> Variable: longitude (coordinate)
> Type: float
> Total Size: 576 bytes
> 144 values
> Number of Dimensions: 1
> Dimensions and sizes: [longitude | 144]
> Coordinates:
> Number Of Attributes: 3
> long_name : longitude
> units : degrees_east
> standard_name : longitude
> The results show that the units of coordinate is all right. So can
> anyone tell me what the problem is? Any help will be appreciated.
>
> Thank you!
> Lawrence
>
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.2.0 : Tue Feb 06 2007 - 15:01:55 MST