Re: Question about contour plots

From: Yaosheng Chen <jeffelf_at_nyahnyahspammersnyahnyah>
Date: Mon Aug 08 2011 - 11:57:58 MDT

Hi Mary,

Thank you for the script. I understand what you are talking now.

What I'm talking about is, what if the levels are also a two dimension
data set (levels vs time).

Use your script as an example. Assuming for the first half of data
(that is, data(:,0:(ntim / 2 - 1))), the levels are (/1000, 925, 850,
750, 600, 500, 400, 250, 100./). However, the second of data
(data(:,(ntim / 2 : (ntim - 1)))) are located at levels (/1000, 900,
850, 750, 600, 500, 400, 250, 100./).

Is there any way to make plots for that?

Thanks,
Yaosheng

On Fri, Aug 5, 2011 at 3:41 PM, Mary Haley <haley@ucar.edu> wrote:
> Yaosheng,
>
> It depends on how dramatically your pressure values change.
>
> We have a pressure/height versus time example page:
>
> http://www.ncl.ucar.edu/Applications/height_time.shtml
>
> 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.
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> 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,
>>
>> Thank you for your reply.
>>
>> 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
>
>
Received on Mon Aug 8 11:58:03 2011

This archive was generated by hypermail 2.1.8 : Fri Aug 12 2011 - 11:48:30 MDT