# Re: Question about contour plots

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Aug 05 2011 - 13:41:33 MDT

Yaosheng,

It depends on how dramatically your pressure values change.

We have a pressure/height versus time example page:

These pressure values look something like 1000, 925, 850, 750, 600, 500, 400, 250, 100.

If you try to plot something where your values are regularly spaced for a bit, and then suddenly change drastically, then you will get a warning and possibly the wrong plot:

warning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation for Y axis failed: consider adjusting trYTensionF value

Run this script to see what I'm talking about. The data for the second frame has a very irregular "lev" coordinate array which causes a spline warning and the Y axis is then just index values.

begin
;---Generate some dummy data.
level = (/1000, 850, 700, 500, 400, 300, 250, 200, 150, 100/)
time = ispan(1,40,2)

ntim = dimsizes(time)
nlev = dimsizes(level)
data = generate_2d_array(10, 12, -20., 17., 0, (/ nlev,ntim/))

;---Name the dimensions and attach coordinate arrays
data!0 = "lev"
data!1 = "time"
data&lev = level
data&time = time

;---Start the graphics
wks = gsn_open_wks("x11","ph")
gsn_define_colormap(wks,"rainbow")

;---Set some plot options
res = True
res@gsnMaximize = True ; Maximize plot in frame
res@gsnSpreadColors = True ; Span full color map
res@cnFillOn = True ; Turn on contour fill
res@cnLinesOn = False ; Turn off contour lines
res@lbLabelAutoStride = True ; Control labelbar spacing

;---This plot is fine, no warnings.
plot = gsn_csm_contour(wks,data,res)

;---Change the levels. You will get a spline warning.
data&lev = (/1000, 950, 900, 850, 800, 750, 250, 200, 150, 100/)
plot = gsn_csm_contour(wks,data,res)

;---This removes the spline warning.
res@trYTensionF = 5.5
plot = gsn_csm_contour(wks,data,res)

end

On Aug 5, 2011, at 12:09 PM, Yaosheng Chen wrote:

> Hi Mary,
>
>
> In fact it is just the pressure (P and PB) and wind speed derived from
> U and V in a WRF output file.
>
> I want to make a pressure vs time plot, with contours showing wind speed.
>
> The pressure for a given layer, for example the second layer from
> surface, changes slightly every time step. But when I make plots I
> just assume the pressure dimension does not change at all.
>
> Just curious if pressure change dramatically every time step, whether
> I can make a plot considering that change.
>
> Thanks.
> Yaosheng
>
> On Wed, Aug 3, 2011 at 5:24 PM, Mary Haley <haley@ucar.edu> wrote:
>> Yaosheng,
>>
>> I'm not sure I have enough information to answer your question.
>> Can you send me the output of doing "printVarSummary" on the
>> data array you want to plot?
>>
>> --Mary
>>
>>
>> On Aug 3, 2011, at 2:00 PM, Yaosheng Chen wrote:
>>
>>> Hi,
>>>
>>> Just out of curious, is it possible to make pressure vs hight contour
>>> plots with a data set that the number and values of pressure levels of
>>> which vary with time step without pre-processing the data (for example
>>> interpolate the data to some common pressure level)?
>>>
>>> Thanks,
>>> Yaosheng
>>> _______________________________________________
>>> 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
Received on Fri Aug 5 13:41:41 2011

This archive was generated by hypermail 2.1.8 : Fri Aug 05 2011 - 14:53:54 MDT