Re: fixed axis scale using gsn_csm_pres_hgt

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 06 2011 - 12:48:04 MDT

The only way to do this is to make your data array two elements larger in the Y (leftmost) dimension, and create a new Y coordinate array that has extra values at both end of the axis. When you plot this, then, you will get little margins at the top and bottom.

This is untested, but something like this:

  dims = dimsizes(data)
  nx = dims(1)
  ny = dims(0)
  nyp2 = ny + 2

  ycoord = data&$data!0$
   
;---Create new arrays
  data_p2 = new((/nyp2,nx/),typeof(data),data@_FillValue)
  ycoord_p2 = new(nyp2,typeof(ycoord))

;---Copy over data
  data_p2(1:ny,:) = (/data/) ; The rest of data_p2 will be missing
  ycoord_p2(1:ny) = ycoord
  ycoord_p2(0) = ...set to some value < ycoord(0)
  ycoord_p2(ny+1) = ...set to some value > ycoord(ny-1)

;---Copy dimension names and attach new coordinate arrays
  data_p2!0 = data!0
  data_p2!1 = data!1
  data_p2&$data!0$ = ycoord_p2
  data_p2&$data!1$ = data&$data!1$

   copy_VarAtts(data,data_p2) ; Copy rest of attributes

On Apr 6, 2011, at 3:26 AM, Leung Samuel wrote:

> Hi,
>
> Regarding the same image I attached before, I noticed the wind barbs at max and min levels (100hPa and 1000hPa) on the y-axis are not visible. Is there a way that I can make more space for it to be displayed on the image?
>
> Thanks,
> Samuel Leung
>
> On Mon, Apr 4, 2011 at 11:39 AM, Leung Samuel <shwl0608@gmail.com> wrote:
> Mary,
>
> Thanks for your suggestion. After having such setting, the levels are less packed, but they are still not equally spaced. Anyway it is still good.
>
> Samuel
>
> On Fri, Apr 1, 2011 at 11:22 PM, Mary Haley <haley@ucar.edu> wrote:
> Hi Samuel,
>
> This is a quick guess, but try setting the "trYLog" resource to False. It is being set to True by the gsn_csm_pres_hgt routine, and hopefully this would be all you need.
>
> --Mary
>
> On Apr 1, 2011, at 3:35 AM, Leung Samuel wrote:
>
>> ncl-talk,
>>
>> I would like to use the fixed y-axis scale on the press/height vs latitude plot. Please take a look at the attached image. Currently it follows the fixed scale of right y-axis (i.e. the height). The lower levels (those 800~1000hPa) are packed too much.
>>
>> Is there a way to arrange the tickmarks of left y-axis instead of right y-axis in equal/customized width? I checked the example "axes_1.ncl" in http://www.ncl.ucar.edu/Applications/axes.shtml but the function gsnYAxisIrregular2Linear did not work in my script.
>>
>> My script is also attached for your reference.
>>
>> Thanks a lot.
>>
>> Regards,
>> Samuel Leung
>> <VCRN.png><vcrn.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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Apr 6 12:48:11 2011

This archive was generated by hypermail 2.1.8 : Fri Apr 08 2011 - 09:34:26 MDT