Re: CellFill: specify cell width?

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Thu Mar 28 2013 - 13:17:59 MDT

Hi Phillip,

The only thing wrong with the res@gsnXAxisIrregular2Linear="True" is that the value True should not be in quotes. True is a logical keyword in NCL, and, for the time being at least, there is
no conversion between the string value "True" and the logical value True. This probably is something we could fix in the future.

With that change I get the plot I have attached here. I am not sure what your plot with the incorrect contour lines looked like but after examining this one for awhile I believe this plot is correct.
I printed out the min and max values of each column using

print("min: " + dim_min_n(vmax,0) + " max: " + dim_max_n(vmax,0))

(0) min: 0.079964 max: 0.967137
(1) min: 1.92389 max: 5.57239
(2) min: 0.399113 max: 0.810121
(3) min: 1.06264 max: 3.69396
(4) min: 1.59816 max: 4.65261
(5) min: 0.0795387 max: 0.899753
(6) min: 0.197804 max: 0.631386

These numbers are pretty discontinuous from column to column, and the data is low resolution, so there is a lot of interpolation required to generate anything like a smooth set of isolines.
Note: the warnings involving gsnStringFont and gsnLeftString occur because these resources are only supported for the gun_csm family of graphics functions.
 -dave

On Mar 27, 2013, at 3:19 PM, Phil Stauffer <philstau@ucar.edu> wrote:

> Hi Dave,
>
> No I was on tikal a 64bit linux machine. I have attached the source codes.
>
>
> Thanks,
>
> Phillip
>
>
> On 3/27/13 3:15 PM, David Brown wrote:
>> Hi Phil,
>> I'll need the source for the shared object files unless I can run on an identical system. It is definitely is not working on my mac. Were you using geyser or caldera perhaps?
>> -dave
>>
>>
>> On Mar 27, 2013, at 3:06 PM, Phil Stauffer <philstau@ucar.edu> wrote:
>>
>>> Hello Dave,
>>>
>>>
>>> If I use the res@gsnXAxisIrregular2Linear="True", I get these errors:
>>>
>>>
>>> fatal:["NclVar.c":1376]:Assignment type mismatch, right hand side can't be coerced to type of left hand side
>>> fatal:Execute: Error occurred at or near line 1434 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl
>>>
>>> fatal:Execute: Error occurred at or near line 8589 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl
>>>
>>> fatal:Execute: Error occurred at or near line 352 in file Maxvort-test.ncl
>>>
>>>
>>> This is the line 352 in my script:
>>> plot = gsn_contour(wks,vmax,res)
>>>
>>> If I comment out the gsnXAxisIrregular2Linear then the script runs and the cell widths are changed, but the contour lines are not correct.
>>>
>>> I have placed my code and files at:
>>> ftp://ftp.eol.ucar.edu/pub/temp/users/philstau/Dave-Brown/Maxvort.tar.gz
>>>
>>> If you have a chance to look at it I would be thankful.
>>>
>>>
>>> Thanks,
>>>
>>> Phillip
>>>
>>>
>>>
>>>
>>> On 3/27/13 12:54 PM, David Brown wrote:
>>>> Hi Phillip,
>>>>
>>>> This should be possible. However, you will need a coordinate array that specifies the bounds of each cell. Bounding coordinates cannot be attached as regular coordinate variables to the data. It also may be that the gsn_csm_contour routine would not like them. If that is the case you can try using gsn_contour instead.
>>>>
>>>> I notice that there are gaps between the end of each leg and the beginning of the next leg. I assume you don't really want to see them in the plot. That means your coordinate array should not represent actual time, but should be thought of as seconds of air time with 0 representing the beginning of the first leg.
>>>>
>>>> There should be 1 more bounding coordinate than legs (8 values). I am not going to calculate the whole scenario, but there would be 3 values to represent the beginning of the first leg to the end of the second:
>>>>
>>>> 0, 918, 1998, ; air time in seconds accumulated from the start of first leg.
>>>>
>>>> If you want the tick marks in the center of each leg then the tmXBValues should have one less values than the coordinate array and be in the center of each interval, starting with 459, 2458.
>>>> Hopefully my arithmetic is correct.
>>>>
>>>> The tmXBLabels can remain as is.
>>>>
>>>> Set the coordinate array using the resource sfXArray.
>>>> Finally set gsnXAxisIrregular2Linear to True and set trXMinF and trXMaxF to the beginning and end values of your coordinate array.
>>>>
>>>> If that doesn't work, send me your complete script and the data offline and I will try to take a look.
>>>> -dave
>>>>
>>>> On Mar 27, 2013, at 10:28 AM, Phil Stauffer <philstau@ucar.edu> wrote:
>>>>
>>>>> Hello All,
>>>>>
>>>>> I have a contour plot of maximum vorticity, vmax(/height,flight leg/). There are 7 flight legs. What I want is to have the cell width be representative of the duration of the flight leg, since each flight leg is not the same time interval. Any I ideas on how to accomplish this?
>>>>> Or a different approach?
>>>>>
>>>>> <fihghihi.png>
>>>>>
>>>>> Here are my plot resources:
>>>>>
>>>>> res = True
>>>>> res@gsnMaximize = True
>>>>> res@cnFillOn = True
>>>>> res@cnFillMode = "CellFill"
>>>>> res@cnLineLabelsOn = True
>>>>> res@gsnSpreadColors = True
>>>>> res@gsnFrame = False
>>>>> res@gsnDraw = False
>>>>> res@sfYArray = f->z
>>>>> res@tiXAxisString = "Time (UTC)"
>>>>> res@tiYAxisString = "Height (km)"
>>>>> res@tiXAxisFontHeightF = 0.01
>>>>> res@tiYAxisFontHeightF = 0.01
>>>>> res@gsnStringFont = "helvetica"
>>>>> res@tmYLLabelFontHeightF = 0.0095
>>>>> res@tmXBLabelFontHeightF = 0.009
>>>>> res@lbOrientation = "Vertical"
>>>>> res@tmXBMajorOutwardLengthF = 0.0
>>>>> res@tmYLMajorOutwardLengthF = 0.0
>>>>> res@tmXBMinorOutwardLengthF = 0.0
>>>>> res@tmYLMinorOutwardLengthF = 0.0
>>>>> res@cnLabelMasking = True
>>>>> res@cnLineLabelBackgroundColor = "transparent"
>>>>> res@lbLabelFontHeightF = 0.0075
>>>>> res@gsnLeftString = "Vertical Vorticity 10~S~-3~N~ s~S~-1~N~"
>>>>>
>>>>>
>>>>> res@tmYLMode = "Explicit"
>>>>> res@tmYLValues = fspan(0.45,11.25,19)
>>>>> res@tmYLLabels = fspan(0.45,11.25,19)+ " "
>>>>>
>>>>> res@tmXBMode = "Explicit"
>>>>> res@tmXBValues = ispan(0,6,1)
>>>>> ;res@tmXBLabels = (/"Leg0","Leg1","Leg2","Leg3","Leg4","Leg5","Leg6"/)
>>>>> res@tmXBLabels = (/"2214:18 -~C~2229:00", \
>>>>> "2230:00 -~C~2248:00", \
>>>>> "2250:00 -~C~2305:05", \
>>>>> "2306:00 -~C~2325:00", \
>>>>> "2326:00 -~C~2342:30", \
>>>>> "2344:30 -~C~0001:30", \
>>>>> "0002:45 -~C~0017:30"/)
>>>>>
>>>>>
>>>>> res@tiMainString = "Maximum Bookend Vorticity"
>>>>> res@gsnSpreadColorStart = 129
>>>>> res@gsnSpreadColorEnd = -1
>>>>> plot = gsn_csm_contour(wks,vmax,res)
>>>>> draw(plot)
>>>>> frame(wks)
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Phillip
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>
> <LEI-nc-q.f><LEI-nc-q0.f><LEI-nc.f>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Mar 28 13:18:22 2013

This archive was generated by hypermail 2.1.8 : Tue Apr 02 2013 - 21:23:48 MDT