[ncl-talk] Hovmoller Plot with 2d lat/lon (Y coordinates out of data range)
Mary Haley
haley at ucar.edu
Mon Oct 13 22:29:38 MDT 2014
Dave,
The gsn_csm_hov script is meant to only be for rectilinear grids, and you
are trying to use it on a curvilinear grid (i.e., one represented by 2D
lat/lon grids). The documentation is not clear about this unfortunately.
My suggestion is to just use gsn_csm_contour, and pass in the time and
longitude arrays via the sfYArray and sfXArray resources:
new_time = conform(new_lon(:,0,:),time,0)
res at sfYArray = new_time
res at sfXArray = new_lon
--Mary
On Thu, Oct 9, 2014 at 8:28 PM, David Adams <dave.k.adams at gmail.com> wrote:
> HI NCLers,
> I am trying to make a hovmoller plot but it does appear that my
> coordinates are correct.
>
> warning:ContourPlotInitialize: Y coordinates out of data range: defaulting
> warning:ContourPlotInitialize: Zero Y coordinate span:
> defaulting:[errno=1104]
>
> and then a blank plot. The code is from the NCL website with slight
> modification
>
>
> --------------------------------------------------------------------------------
> begin
> ;=============================================
> ; data processing
> ;===========================================
> fili = "test.nc" ; filename
> f = addfile (fili , "r") ; add file
> new_temp = f->new_temp ; get chi
> new_lat = f->new_lat
> new_lon = f->new_lon
> ;==============================================
> ; creat plot: Reverse time axis; contour labels horizontal
> ; Dash negative contours; double width of Zero
> ;==============================================
> wks = gsn_open_wks ("pdf", "hov")
> res = True ; plot mods desired
> res at gsnContourZeroLineThicknessF = 2. ; doubles thickness of
> zero contour
> res at gsnContourNegLineDashPattern = 1 ; sets negative contours
> to dash pattern 1
> res at trYReverse = True ; reverse y axis
> res at tiMainString = "Reverse Time" ; title
> res at cnLineLabelAngleF = 0.0 ; [cn] label horizontal
>
> ;new_temp at lat2d = new_lat(0,:,:)
> ;new_temp at lon2d = new_lon(0,:,:)
>
> plot = gsn_csm_hov(wks, new_temp(:,0,:), res ) ; default
> hovmueller
> end
>
> --------------------------------------------------------------------------------------------
> Here is an ncdump -h on the data file
>
> netcdf test {
> dimensions:
> yc = 221 ;
> xc = 141 ;
> time = UNLIMITED ; // (130 currently)
> variables:
> float new_temp(time, yc, xc) ;
> new_temp:time = 1372896900 ;
> new_temp:units = "K" ;
> new_temp:coordinates = "lon lat" ;
> new_temp:type = "GVAR" ;
> new_temp:long_name = "Temperature" ;
> float new_lat(time, yc, xc) ;
> new_lat:units = "degrees_north" ;
> new_lat:long_name = "lat" ;
> float new_lon(time, yc, xc) ;
> new_lon:units = "degrees_east" ;
> new_lon:long_name = "lon" ;
> int time(time) ;
> time:units = "seconds since 2013-185 00:15" ;
>
>
> any obvious errors?
>
> thanks in advance,
> Dave
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141013/3d33efcf/attachment.html
More information about the ncl-talk
mailing list