[ncl-talk] how to change tickmark to standard pressure levels in WRF cross-section plot

Richard Liang musicpianoljy at gmail.com
Mon Dec 4 11:53:29 MST 2017


Hi, Bill

Sorry for my late reply. Your solution works very well. I can set the y
tickmark to standard pressure now.

The latitude and longitude tickmark in the cross section are also hard to
set, they are not in standard degree such as 5N,10N. Hopefully, NCL can
improve the tickmark setting.

Thank you very much

Richard



On Mon, Nov 27, 2017 at 4:16 PM, Bill Ladwig <ladwig at ucar.edu> wrote:

> Hi Richard,
>
> An easy way to modify the routine without breaking your installation is to
> create a new file (e.g. myfile.ncl), then copy the wrf_user_intrp3d routine
> from WRFUserARW.ncl in to this file.  Modify your copy of wrf_user_intrp3d
> to set the levels that you want.  This will be around line 370, and the
> current code looks like:
>
> ;  interp to constant z grid
>>      if(var2dz(0,0) .gt. var2dz(1,0) ) then  ; monotonically decreasing
>> coordinate
>>         z_max = floor(max(z)/10)*10     ; bottom value
>>         z_min = ceil(min(z)/10)*10      ; top value
>>         dz = 10
>>         nlevels = tointeger( (z_max-z_min)/dz)
>>         z_var2d = new( (/nlevels/), typeof(z))
>>         z_var2d(0) = z_max
>>         dz = -dz
>>      else
>>         z_max = max(z)
>>         z_min = 0.
>>         dz = 0.01 * z_max
>>         nlevels = tointeger( z_max/dz )
>>         z_var2d = new( (/nlevels/), typeof(z))
>>         z_var2d(0) = z_min
>>      end if
>>
>>      do i=1, nlevels-1
>>         z_var2d(i) = z_var2d(0)+i*dz
>>      end do
>
>
> You'll want to set z_var2d to be the levels that you want, and comment out
> the rest.  Hopefully everything else will just work.  Finally, at the top
> of your plotting script, do:
>
> load "/path/to/myfile.ncl"
>
>
> where the "/path/to" is the path to where the myfile.ncl is located on
> your system.  As long as you have the "undef("wrf_user_intrp3d")" above
> your definition of wrf_user_intrp3d in myfile.ncl, this will clobber the
> WRFUserARW.ncl version.  Note that in recent versions of NCL,
> WRFUserARW.ncl is loaded by default, so you don't need load statements for
> it anymore.  The only load statement you should need is the one shown above.
>
> The ability to set your own cross section levels will be coming in a
> future release.  Currently wrf-python supports this, but it needs to get
> ported back to NCL.
>
> Hope this helps,
>
> Bill
>
> On Thu, Nov 23, 2017 at 10:07 PM, music piano <musicpianoljy at gmail.com>
> wrote:
>
>>
>>
>> Hi, Everyone
>>
>> Example is here
>> http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Exa
>> mples/CROSS_SECTION/wrf_CrossSection3.htm
>>
>> The tickmarks here are 1010, 960, 910...... But I want standard levels
>> such as 1000, 950, 900.....
>>
>> My analysis of the code is as follow:
>> (1)
>> rh_plane = wrf_user_intrp3d(rh,p,"v",plane,0.,opts)
>>
>> It interpolates the data into pressure coordinate. However, the pressure
>> levels are not standard levels as I check the subroutine "WRFUserARW.ncl"
>> . It begins with the highest pressure from the bottom, not from 1000. Thus,
>> the tickmark position represents nonstandard pressure
>>
>> (2) opts_xy at tmYLMode = "Explicit"
>> opts_xy at tmYLValues = fspan(0,zspan,nz) opts_xy at tmYLLabels =
>> sprintf("%.0f",fspan(zmin,zmax,nz))
>>
>> give labels to each tickmark position. Since the tickmark position is not
>> in standard pressure, it shows 1010, 960.....
>> I have tried to use @ tmYLMode ="Manual"  *tmYLTickStartF
>> <https://www.ncl.ucar.edu/Document/Graphics/Resources/tm.shtml#tmYLTickStartF> *,
>> or set trXMaxF , none of them works. They still plot tickmark position.
>>
>> I can possibly modify "WRFUserARW.ncl to let it interpolation to
>> standard levels, but that may require reinstalling NCL in the machine,
>> which is hard.
>>
>> Does anyone know how to produce tickmarks which specify the standard
>> pressure value?
>>
>> Thank you very much
>> Richard
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171204/10f5e19c/attachment.html>


More information about the ncl-talk mailing list