forrest@2: pro zonal_npp forrest@2: forrest@2: cdfid=ncdf_open('npp_T42_mean_2000-2004.nc') forrest@2: lon_dimid=ncdf_dimid(cdfid,'lon') forrest@2: ncdf_diminq,cdfid,lon_dimid,lon_name,lon_size forrest@2: lat_dimid=ncdf_dimid(cdfid,'lat') forrest@2: ncdf_diminq,cdfid,lat_dimid,lat_name,lat_size forrest@2: lon_varid=ncdf_varid(cdfid,'lon') forrest@2: ncdf_varget,cdfid,lon_varid,lon forrest@2: lat_varid=ncdf_varid(cdfid,'lat') forrest@2: ncdf_varget,cdfid,lat_varid,lat forrest@2: npp_varid=ncdf_varid(cdfid,'NPP') forrest@2: ncdf_varget,cdfid,npp_varid,npp forrest@2: ncdf_attget,cdfid,npp_varid,'long_name',long_name forrest@2: ncdf_attget,cdfid,npp_varid,'_FillValue',missing_value forrest@2: ncdf_attget,cdfid,npp_varid,'units',units forrest@2: ncdf_close,cdfid forrest@2: forrest@2: npp_zmean=fltarr(lat_size) forrest@2: npp_zstddev=fltarr(lat_size) forrest@2: forrest@2: for i=0,lat_size-1 do begin forrest@2: vdata = npp[*,i] forrest@2: idx = where(vdata ne missing_value,cnt) forrest@2: if cnt gt 0 then begin forrest@2: npp_zmean[i] = mean(vdata[where(vdata ne missing_value)]) forrest@2: endif else begin forrest@2: npp_zmean[i] = 0. forrest@2: endelse forrest@2: if cnt gt 1 then begin forrest@2: npp_zstddev[i] = stddev(vdata[where(vdata ne missing_value)]) forrest@2: endif else begin forrest@2: npp_zstddev[i] = 0. forrest@2: endelse forrest@2: endfor forrest@2: forrest@2: ofname='npp_T42_mean_2000-2004_zonal.dat' forrest@2: openw,1,ofname forrest@2: printf,1,' Latitude ZonalMean_NPP ZonalStdDev_NPP' forrest@2: for i=0,lat_size-1 do begin forrest@2: printf,1,lat[i],npp_zmean[i],npp_zstddev[i] forrest@2: endfor forrest@2: close,1 forrest@2: forrest@2: return forrest@2: end