forrest@2
|
1 |
pro zonal_npp
|
forrest@2
|
2 |
|
forrest@2
|
3 |
cdfid=ncdf_open('npp_T42_mean_2000-2004.nc')
|
forrest@2
|
4 |
lon_dimid=ncdf_dimid(cdfid,'lon')
|
forrest@2
|
5 |
ncdf_diminq,cdfid,lon_dimid,lon_name,lon_size
|
forrest@2
|
6 |
lat_dimid=ncdf_dimid(cdfid,'lat')
|
forrest@2
|
7 |
ncdf_diminq,cdfid,lat_dimid,lat_name,lat_size
|
forrest@2
|
8 |
lon_varid=ncdf_varid(cdfid,'lon')
|
forrest@2
|
9 |
ncdf_varget,cdfid,lon_varid,lon
|
forrest@2
|
10 |
lat_varid=ncdf_varid(cdfid,'lat')
|
forrest@2
|
11 |
ncdf_varget,cdfid,lat_varid,lat
|
forrest@2
|
12 |
npp_varid=ncdf_varid(cdfid,'NPP')
|
forrest@2
|
13 |
ncdf_varget,cdfid,npp_varid,npp
|
forrest@2
|
14 |
ncdf_attget,cdfid,npp_varid,'long_name',long_name
|
forrest@2
|
15 |
ncdf_attget,cdfid,npp_varid,'_FillValue',missing_value
|
forrest@2
|
16 |
ncdf_attget,cdfid,npp_varid,'units',units
|
forrest@2
|
17 |
ncdf_close,cdfid
|
forrest@2
|
18 |
|
forrest@2
|
19 |
npp_zmean=fltarr(lat_size)
|
forrest@2
|
20 |
npp_zstddev=fltarr(lat_size)
|
forrest@2
|
21 |
|
forrest@2
|
22 |
for i=0,lat_size-1 do begin
|
forrest@2
|
23 |
vdata = npp[*,i]
|
forrest@2
|
24 |
idx = where(vdata ne missing_value,cnt)
|
forrest@2
|
25 |
if cnt gt 0 then begin
|
forrest@2
|
26 |
npp_zmean[i] = mean(vdata[where(vdata ne missing_value)])
|
forrest@2
|
27 |
endif else begin
|
forrest@2
|
28 |
npp_zmean[i] = 0.
|
forrest@2
|
29 |
endelse
|
forrest@2
|
30 |
if cnt gt 1 then begin
|
forrest@2
|
31 |
npp_zstddev[i] = stddev(vdata[where(vdata ne missing_value)])
|
forrest@2
|
32 |
endif else begin
|
forrest@2
|
33 |
npp_zstddev[i] = 0.
|
forrest@2
|
34 |
endelse
|
forrest@2
|
35 |
endfor
|
forrest@2
|
36 |
|
forrest@2
|
37 |
ofname='npp_T42_mean_2000-2004_zonal.dat'
|
forrest@2
|
38 |
openw,1,ofname
|
forrest@2
|
39 |
printf,1,' Latitude ZonalMean_NPP ZonalStdDev_NPP'
|
forrest@2
|
40 |
for i=0,lat_size-1 do begin
|
forrest@2
|
41 |
printf,1,lat[i],npp_zmean[i],npp_zstddev[i]
|
forrest@2
|
42 |
endfor
|
forrest@2
|
43 |
close,1
|
forrest@2
|
44 |
|
forrest@2
|
45 |
return
|
forrest@2
|
46 |
end
|