# Problem computing grid points

From: Brandon Fisel <bjfisel_at_nyahnyahspammersnyahnyah>
Date: Tue, 28 Apr 2009 14:29:48 -0500

Dear NCL'ers

I'm attempting to compute two sums below, poleward of a specified latitude
and plot them using a time series. The .nc file contains daily averaged sea
ice fractions for 1998.
Sum 1 = ( # of grid points with 50% < fraction < 90% ) x cos(lat)
Sum 2 = ( all grid points x cos(lat))

Below is part of the script:

; Add file and grab attributes
print(f)
; Get times for the file and set attributes
TimeChar = f->Times
DimTimeChar = dimsizes(TimeChar)
nTime = DimTimeChar(0)-1 ; convenience
times = wrf_user_list_times(f)
ntimes = dimsizes(times)
print ("wrf_user_list_times is:" + ntimes)
lat = f->XLAT_M(:,:)
DimLat = dimsizes(lat)
nS_N = DimLat(0)
nW_E = DimLat(1)
lat_at_long_name = "Latitude"
lat_at_standard_name = "latitude"
lat_at_units = "degrees latitude"
lat!0 = "south_north"
lat!1 = "west_east"
lon = f->XLONG_M(:,:)
lon_at_long_name = "Longitude"
lon_at_standard_name = "longitude"
lon_at_units = "degrees longitude"
lon!0 = "south_north"
lon!1 = "west_east"
; Plot daily critical fractions
do nt=0,nTime
type = "ps"
prefix = "daily_cri_fra_"
suffix = times(nt)+""
print ("Suffix is:" + suffix)
path = diro+""+prefix+""+suffix
print ("Path is:" + path)
wks = gsn_open_wks(type,path)
dims = getfilevardims(f,"fsi")
si = f->fsi(nt,:,:)
lat2d = lat
lon2d = lon
si_at_lat2d = lat2d
si_at_lon2d = lon2d
si = si/100
printVarSummary(si)
si_min = .50 ; minimum fraction
si_max = .90 ; maximum fraction
; Not certain from here on
lats = new((/75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90/),float) ;
create array of lats
do nLat=75,lats-1
ice(nLat) = si(lat|:,lon|:)
cr_level = dim_num(ice.ge.si_min .and. ice.le.si_max) ; type integer
sum of grid points
copy_VarCoords(ice,cr_level)
sum_crlv = cr_level*cos(nLat)
sum_tot = sum_crlv(nLat)
end do