[ncl-talk] X axis tick mark with Explicit Mode

Prasad Kunjeer pskunjeer at gmail.com
Sat Sep 14 03:00:47 MDT 2019


Sir,

Thanks it is working. But we are not considering longitude which is
constant.

Regards
प्रसाद कुंजीर / Prasad Kunjeer
वैज्ञानिक - सी / Scientist - C
केन्द्रीय जल और विद्युत अनुसंधान शाला / Central Water and Power Research
Station
पुणे 411 024/ Pune 411 024


On Sat, Sep 14, 2019 at 4:37 AM Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Prasad,
> Please do not write to individuals who respond to ncl-talk and not to
> ncl-talk itself, as that way others can assist and see the resolution of
> the issue. My original email still stands: The range of values specified in
> tmXBValues needs to match the range of x-axis coordinate values of the
> plotted array. In your case, from your printVarSummary output, you have
> latitudes that are around 30N:
> lat: [29.84782..33.84531]
> so you will want to set tmXBValues to have values between 29.84 and 33.84.
> For example:
> resx at tmXBMode = "Explicit"
> resx at tmXBValues = fspan(29.5,34,10)
> resx at tmXBLabels = resx at tmXBValues
>
> Adam
>
> On Thu, Sep 12, 2019 at 1:12 AM Prasad Kunjeer <pskunjeer at gmail.com>
> wrote:
>
>> Sir,
>> As suggested by you, I have drawn in default mode without specifying the
>> explicit x labels. The output is enclosed as an attachment. The figure
>> shows only one lat value of 30N. The output of the printVarSummary(slice1)
>> is
>>
>> Variable: slice1
>> Type: float
>> Total Size: 19328 bytes
>>             4832 values
>> Number of Dimensions: 2
>> Dimensions and sizes: [lev | 32] x [lat | 151]
>> Coordinates:
>>             lev: [996.9073..5.045747]
>>             lat: [29.84782..33.84531]
>> Number Of Attributes: 8
>>   lon : 76.08612
>>   Time : 2018-09-20_15:00:00
>>   FieldType : 104
>>   MemoryOrder : XYZ
>>   description : x-wind component
>>   units : m s-1
>>   stagger :
>>   coordinates : XLONG XLAT
>>
>> The Variable does not have longitude value, is this giving the problem in
>> an explicit mode where I am specifying the longitude value.
>>
>> I have tried explicit mode without longitudinal value but this also gives
>> no x value labels.
>>
>> Regards
>> प्रसाद कुंजीर/ Prasad Kunjeer
>> वैज्ञानिक - सी / Scientist - C
>> केन्द्रीय जल और विद्युत अनुसंधान शाला / Central Water and Power Research
>> Station
>> पुणे 411 024/ Pune 411 024
>>
>>
>> On Wed, Sep 11, 2019 at 9:44 PM Adam Phillips <asphilli at ucar.edu> wrote:
>>
>>> Hi Prasad,
>>> Whenever you are trying to set explicit tickmarks and they disappear,
>>> then it is likely that the domain of your set tm??Values is outside the
>>> corresponding range of the data coordinate variable (in this case the
>>> latitudes of your slice1 array). Try commenting out the resources that
>>> start with res at tmXB*, and labels should appear (although they likely
>>> will not be what you want). Once you see the range of the default tick mark
>>> labels, that indicates what the range should be for your res at tmXBValues
>>> resource.
>>>
>>> If the above does not help please respond to ncl-talk with the output
>>> from printVarSummary(slice1)
>>> Adam
>>>
>>>
>>>
>>>
>>>
>>> On Wed, Sep 11, 2019 at 12:30 AM Prasad Kunjeer via ncl-talk <
>>> ncl-talk at ucar.edu> wrote:
>>>
>>>> Sir,
>>>> I am using the following script to plot U wind from WRF output file. I
>>>> am able to plot the figure, but the X-axis tick marks are not appearing.
>>>> The script is follow
>>>>
>>>> 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/wrf/WRF_contributed.ncl"
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
>>>>
>>>> begin
>>>>
>>>>     fName = "/home/emsuser/Build_WRF/wrfprd/results/do3/t/do3.nc"
>>>>     f = addfile(fName, "r")
>>>>
>>>>     U1           = f->U
>>>>     U            = wrf_user_unstagger(U1,U1 at stagger)
>>>>     lat          = f->XLAT(0,:,0)
>>>>     lon          = f->XLONG(0,0,:)
>>>>     znu          = f->ZNU(0,:) ; eta levels
>>>>     lev          = znu*1000 ; [996.9073..5.045747]
>>>>     Time         = chartostring( f->Times(:,:) )
>>>>
>>>>     U!1 = "lev"
>>>>     lev at units= "hPa"
>>>>     U!0 = "Time"
>>>>     U!2 = "lat"
>>>>     lat at units = "degree_north"
>>>>     U!3 = "lon"
>>>>     lon at units = "degree_east"
>>>>
>>>>     U&lev = lev
>>>>     U&Time = Time
>>>>     U&lat = lat
>>>>     U&lon = lon
>>>>
>>>>     wgt   = (/ 1., 3., 4., 3., 1./)                  ; wgts for
>>>> temporal smooth
>>>>     wgt   = wgt/sum(wgt)                             ; normalize
>>>>
>>>>     lat2d          = f->XLAT(0,:,:)
>>>>     lon2d          = f->XLONG(0,:,:)
>>>>
>>>>     slice         = U(lev|:,Time|:,lat|:,lon|:)      ; trick to copy
>>>> meta data
>>>>     slice1        = U(lev|:,Time|1,lat|84:234,lon|175)
>>>>     printVarSummary(slice1)
>>>>
>>>>
>>>>     wks = gsn_open_wks("png" ,"WRF_U_Wind_New_1")       ; open
>>>> workstation
>>>>
>>>> ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>> ; Create resources for cross section(s)
>>>> ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>>    resx = True
>>>>    resx at gsnMaximize          = True
>>>>    resx at cnFillOn             = True            ; turn on color fill
>>>>    resx at cnLinesOn            = False           ; turn lines on/off
>>>>     ; True is default
>>>>    resx at cnLineLabelsOn       = False           ; turn line labels
>>>> on/off   ; True is default
>>>>    resx at cnFillPalette        = "ncl_default"
>>>>
>>>>    nLabels                   = 8               ; arbitrary
>>>>    resx at tmXBMode             = "Explicit"
>>>>    resx at tmXBLabels           = new(nLabels,"string")
>>>>    resx at tmXBValues           := toint(fspan(84,234,nLabels))
>>>>    do i=0,nLabels-1
>>>>        x = lon2d(resx at tmXBValues(i),176)
>>>>        y = lat2d(resx at tmXBValues(i),176)
>>>>        resx at tmXBLabels(i) = sprintf("%5.1f", y)+"~C~"+sprintf("%5.1f",
>>>> x)
>>>>        print(resx at tmXBLabels(i))
>>>>    end do
>>>>
>>>>    plot  = gsn_csm_pres_hgt(wks, slice1, resx)
>>>>
>>>> end
>>>>
>>>> I have attached the plot for ready reference. Any help is highly
>>>> appreciated.
>>>>
>>>> Regards
>>>> प्रसाद कुंजीर/ Prasad Kunjeer
>>>> वैज्ञानिक - सी / Scientist - C
>>>> केन्द्रीय जल और विद्युत अनुसंधान शाला / Central Water and Power
>>>> Research Station
>>>> पुणे 411 024/ Pune 411 024
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>>
>>> --
>>> Adam Phillips
>>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>>
>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>
>>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190914/0c25a519/attachment.html>


More information about the ncl-talk mailing list