[ncl-talk] Question about ndtooned and histogram plot

Lyndz olagueralyndonmark429 at gmail.com
Sat Sep 14 02:50:34 MDT 2019


Dear NCL experts,

*[Details]*
I  want to plot a histogram with the number of grid points in the y-axis
and rainfall classification in the x-axis.
The attached figure is an example of what I wanted (Desired_output.gif).

The data that I am using can be downloaded from this link:
https://www.dropbox.com/s/lbkjlqgq9era5c7/APHRO_AMJ_1979-2015.nc?dl=0

*[What I have so far]*
The following is the script that I am using:

;***********************************************************
;This script creates a histogram of the number of gridpoints
;with rainfall above 0 mm/day
;Created by Lyndz
;olagueralyndonmark429 at gmail.com
;*******************************************************
begin
fo = addfile("APHRO_AMJ_1979-2015.nc","r")
rain=fo->precip(:,:,:)
rain_region=rain(:,{12.5:22},{120:122.5})
*test=ndtooned(rain_region)*
;*************************************
;Plots histogram
;*************************************
  wks = gsn_open_wks("png","output")             ; send graphics to PNG file
  gsn_define_colormap(wks,"temp1")              ; choose colormap
  res                                 = True
  res at gsnHistogramSelectNiceIntervals = False   ; intervals now float
  res at gsnHistogramComputePercentages  = True    ; change left axis to %
  res at gsnHistogramClassIntervals = (/0,1,5,10,15,20,25,30,25,40,45/)
  res at gsnHistogramComputePercentagesNoMissing = True
  res at tmXBPrecision = 2         ; set the precision to 2 significant digits
  res at tmYLFormat = "#^se"       ; don't use "e" symbol, always show +/-
  res at tiXAxisString   = "Rainfall[mm/day]"
  res at tiYAxisString   = "Number of Grid Points"
  plot=gsn_histogram(wks,test,res)                 ; create histogram with
10 bins
end

*[Issues/Problems]*
[1] The script runs fine. The output is attached (output.png). I am not
sure if  I plotted this correctly. After using ndtooned, I just plotted the
histogram. Is there a way to check if the y-axis is really the number of
gridpoints or the x axis is the rainfall class?
Or is there a way to invoke that the y-axis is the number of gridpoints
when plotting the histogram?

I'll appreciate any help with this.

Sincerely,
Lyndz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190914/d468ce8f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Desired_output.gif
Type: image/gif
Size: 21197 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190914/d468ce8f/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: output.png
Type: image/png
Size: 63939 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190914/d468ce8f/attachment.png>


More information about the ncl-talk mailing list