Re: Log Y-axis on contour plot.

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu Oct 22 2009 - 09:30:53 MDT

ncl-talk: This issue is closed.

Gareth Berry wrote:
> I managed to fix the problem. The cause was a classic
> case of user error: I had a typo in the coordinate array, I had the
> 350hPa level twice!
>
> Sorry to waste your time, but after 8 hours of trying something over
> and over I needed to invoke the "system administrator effect".
>
> Thanks again and keep up the excellent work!
>
> Cheers,
>
> Gareth.
>
>
> On Thu, Oct 22, 2009 at 2:53 PM, Dennis Shea <shea@ucar.edu> wrote:
>
>> I think Mary Haley will have to answer.
>>
>> Sorry
>> D
>> Gareth Berry wrote:
>>
>>> Hi Dennis,
>>>
>>> Thanks for the quick reply. I've pretty much done all of those things
>>> in the examples - I can plot profiles of the data on log axes until
>>> it's coming out of my ears, but I've never been able to get it to work
>>> on contour plots. I've encountered this type of issue before, but I've
>>> just lived with it!
>>>
>>> I've hacked out the appropriate lines of the second example you gave,
>>> but again to no avail. Again the error is:
>>>
>>> warning:ScalarFieldSetValues: irregular coordinate array sfYArray
>>> non-monotonic: defaulting sfYArray
>>> warning:IrTransInitialize: LogAxis requires all positive data extent:
>>> defaulting trYAxisType to LinearAxis
>>>
>>> this is despite having res_at_gsnYAxisIrregular2Log = True
>>>
>>> I've check my coordinate variable, and there are no zero values or
>>> anything silly.
>>>
>>> Variable: level (coordinate)
>>> Type: integer
>>> Total Size: 92 bytes
>>> 23 values
>>> Number of Dimensions: 1
>>> Dimensions and sizes: [level | 23]
>>> Coordinates:
>>> Number Of Attributes: 1
>>> units : hPa
>>> (0) 975
>>> (1) 950
>>> (2) 925
>>> (3) 900
>>> (4) 875
>>> (5) 850
>>> (6) 825
>>> (7) 800
>>> (8) 775
>>> (9) 750
>>> (10) 700
>>> (11) 650
>>> (12) 600
>>> (13) 550
>>> (14) 500
>>> (15) 450
>>> (16) 400
>>> (17) 350
>>> (18) 300
>>> (19) 350
>>> (20) 200
>>> (21) 150
>>> (22) 100
>>>
>>> I'm absolutely stumped!
>>>
>>>
>>> Cheers,
>>>
>>> Gareth.
>>>
>>>
>>>
>>> On Thu, Oct 22, 2009 at 2:05 PM, Dennis Shea <shea@ucar.edu> wrote:
>>>
>>>> See
>>>>
>>>>
>>>> http://www.ncl.ucar.edu/Document/Graphics/Resources/gsn.shtml#gsnYAxisIrregular2Log
>>>>
>>>> Some Examples:
>>>>
>>>>
>>>> Axes
>>>> http://www.ncl.ucar.edu/Applications/axes.shtml#ex2
>>>>
>>>> Contours wo maps
>>>> http://www.ncl.ucar.edu/Applications/conwomap.shtml#ex6
>>>>
>>>> Zonal Average
>>>> http://www.ncl.ucar.edu/Applications/zonal.shtml#ex6
>>>>
>>>> Good luck
>>>>
>>>> Gareth Berry wrote:
>>>>
>>>>> Hi Folks,
>>>>>
>>>>> Stupid question, but this is driving me up the wall!
>>>>>
>>>>> I have a simple 2d data set, pressure x time and I want to plot a
>>>>> contour plot with the log of pressure on the Y-axis. My pressure
>>>>> coordinates are irregularly spaced but range from 100-975hPa.
>>>>>
>>>>> Seems simple, but when using gsn_csm_contour with no resources set for
>>>>> the y-axis NCL complains that "irregular coordinate array sfYArray
>>>>> non-monotonic: defaulting sfYArray" . With gsnYAxisIrregular2Log =
>>>>> True I get: "LogAxis requires all positive data extent: defaulting
>>>>> trYAxisType to LinearAxis" although the coordinate axis values are all
>>>>>
>>>>>> 0 (100-975hPa). Perhaps I'm doing something truely boneheaded, but
>>>>>>
>>>>> infuriatingly I can do logarithmic xy plots of the same dataset at the
>>>>> individual points! I've tried boiling it down to its most basic, but
>>>>> still nothing works!
>>>>>
>>>>> I'm using V5.1.1 on mac osx, if that is relevant. Below is the simple
>>>>> script I've been working with and the (tiny) dataset is attached.
>>>>>
>>>>>
>>>>>
>>>>> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>>>>>
>>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>>>>
>>>>> begin
>>>>>
>>>>> infile = addfile("mofo.nc","r")
>>>>>
>>>>> data = infile->data
>>>>>
>>>>> printVarSummary(data)
>>>>>
>>>>> wks = gsn_open_wks( "x11", "test" )
>>>>>
>>>>> res = True
>>>>>
>>>>> ;res@gsnYAxisIrregular2Linear = True
>>>>> ;res@sfYArray = data&level
>>>>> res@gsnYAxisIrregular2Log = True
>>>>>
>>>>>
>>>>> plot=gsn_csm_contour(wks,data,res)
>>>>>
>>>>> end
>>>>>
>>>>>
>>>>>
>>>>> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>>>>>
>>>>> Any guidance is appreciated!
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Gareth.
>>>>>
>>>>>
>>>>> P.S. I've also tried gsn_csm_pres_hgt, but get even more baffling
>>>>> errors, perhaps someone clever understands if there is a link to my
>>>>> problems above...
>>>>>
>>>>> fatal:ftcurv: Error number 2.
>>>>> fatal:Execute: Error occurred at or near line 2157 in file
>>>>> $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl
>>>>>
>>>>> fatal:Execute: Error occurred at or near line 11289 in file
>>>>> $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> 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 Thu Oct 22 09:30:52 2009

This archive was generated by hypermail 2.1.8 : Fri Oct 23 2009 - 11:36:30 MDT