[ncl-talk] Question about ndtooned and histogram plot
Dennis Shea
shea at ucar.edu
Mon Sep 16 08:15:29 MDT 2019
You can count yourself:
nRain0 = *num*(rain_region.eq.0)
nRain = num(rain_region.gt.0)
nRainMsg = num(ismissing(rain_region))
print(" nRain0="+nRain0)
print(" nRain ="+nRain )
print("nRainMsg="+nRainMsg)
opt = True
opt at PrintStat = True
stat_rain_region = *stat_dispersion*(rain_region, opt )
print("===")
n_1015 = num(rain_region.ge.10 .and. rain_region.lt.15)
print("n_1015="+n_1015)
print("===")
test = *ndtooned*(rain_region)
iGood = *ind*(test.gt.0) ; only grid points > 0.0
test *:=* test(iGood)
On Sat, Sep 14, 2019 at 2:51 AM Lyndz via ncl-talk <ncl-talk at ucar.edu>
wrote:
> 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
>
> _______________________________________________
> 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/20190916/099c9ef1/attachment.html>
More information about the ncl-talk
mailing list