Hi,
I am trying to calculate % of values in a timeseries below a cutoff point,
but keep getting error messages related to not having defined the variables
that I am calculating (not reading in) properly. Just calculating the
variable in the do loop doesn't seem to define them, and when I try to
define them before I calculate them, I've tried a couple ways but haven't
got it right so far. Can anyone help me out with this problem? My script is
below...
The error message is: undefined identifer: pct_drought_mod1 is undefined,
can't continue.
*******************************************************
begin
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/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
; use "$NCARG_ROOT/lib/ncarg/data/cdf/landsea.nc"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
setfileoption("nc","SuppressClose",False)
; open 1st pft map;
in1 = addfile("rainfall.nc","r")
lat =in1->lat
lon=in1->lon
precip_mod1 = in1->rainfall(:,:,:) ;;; this is lat, lon time (91,144, 360)
; calculate the percentage of months in the timeseries where rainfall < 2
mm/d
;pct_drought_mod1(i,j)=0 ---> this sort of thing doesn't seem
to work
;num_drought_mnth_mod1(i,j)=0
;num_drought_mnth_mod1 =0
;pct_drought_mod1 = 0
count = 0
do i=1,144
do j=1,91
do k=1,348
if (k .lt. 2.0) then
count = count +1
end if
end do
print(count)
num_drought_mnth_mod1(i,j) = count
pct_drought_mod1(i,j) = count/348
end do
end do
end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue May 29 13:25:24 2012
This archive was generated by hypermail 2.1.8 : Wed May 30 2012 - 09:25:29 MDT