observed/npp/zonal_npp.pro
changeset 2 e7ba9bcc3020
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/observed/npp/zonal_npp.pro	Thu Mar 26 14:31:28 2009 -0400
     1.3 @@ -0,0 +1,46 @@
     1.4 +pro zonal_npp
     1.5 +
     1.6 +cdfid=ncdf_open('npp_T42_mean_2000-2004.nc')
     1.7 +lon_dimid=ncdf_dimid(cdfid,'lon')
     1.8 +ncdf_diminq,cdfid,lon_dimid,lon_name,lon_size
     1.9 +lat_dimid=ncdf_dimid(cdfid,'lat')
    1.10 +ncdf_diminq,cdfid,lat_dimid,lat_name,lat_size
    1.11 +lon_varid=ncdf_varid(cdfid,'lon')
    1.12 +ncdf_varget,cdfid,lon_varid,lon
    1.13 +lat_varid=ncdf_varid(cdfid,'lat')
    1.14 +ncdf_varget,cdfid,lat_varid,lat
    1.15 +npp_varid=ncdf_varid(cdfid,'NPP')
    1.16 +ncdf_varget,cdfid,npp_varid,npp
    1.17 +ncdf_attget,cdfid,npp_varid,'long_name',long_name
    1.18 +ncdf_attget,cdfid,npp_varid,'_FillValue',missing_value
    1.19 +ncdf_attget,cdfid,npp_varid,'units',units
    1.20 +ncdf_close,cdfid
    1.21 +
    1.22 +npp_zmean=fltarr(lat_size)
    1.23 +npp_zstddev=fltarr(lat_size)
    1.24 +
    1.25 +for i=0,lat_size-1 do begin
    1.26 +   vdata = npp[*,i]
    1.27 +   idx = where(vdata ne missing_value,cnt)
    1.28 +   if cnt gt 0 then begin
    1.29 +      npp_zmean[i] = mean(vdata[where(vdata ne missing_value)])
    1.30 +   endif else begin
    1.31 +      npp_zmean[i] = 0.
    1.32 +   endelse
    1.33 +   if cnt gt 1 then begin
    1.34 +      npp_zstddev[i] = stddev(vdata[where(vdata ne missing_value)])
    1.35 +   endif else begin
    1.36 +      npp_zstddev[i] = 0.
    1.37 +   endelse
    1.38 +endfor
    1.39 +
    1.40 +ofname='npp_T42_mean_2000-2004_zonal.dat'
    1.41 +openw,1,ofname
    1.42 +printf,1,'     Latitude ZonalMean_NPP   ZonalStdDev_NPP'
    1.43 +for i=0,lat_size-1 do begin
    1.44 +   printf,1,lat[i],npp_zmean[i],npp_zstddev[i]
    1.45 +endfor
    1.46 +close,1
    1.47 +
    1.48 +return
    1.49 +end