npp/03.0.05deg_to_T42.ncl.0
changeset 0 0c6405ab2ff4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/npp/03.0.05deg_to_T42.ncl.0	Mon Jan 26 22:08:20 2009 -0500
     1.3 @@ -0,0 +1,77 @@
     1.4 +; ***********************************************
     1.5 +; interpolate into model grids (T31)
     1.6 +; ***********************************************
     1.7 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
     1.8 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
     1.9 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
    1.10 +;************************************************
    1.11 +begin
    1.12 +;************************************************
    1.13 +; output data
    1.14 +;************************************************
    1.15 +  diro  = "/fis/cgd/cseg/people/jeff/clamp/"
    1.16 +  filo  = "Npp_T31_mean.nc"
    1.17 +  c = addfile(diro+filo,"c")
    1.18 +
    1.19 +;************************************************
    1.20 +; read in observed data
    1.21 +;************************************************
    1.22 + g     = addfile ("Npp_0.05deg_mean.nc","r")
    1.23 + bi    = g->NPP   
    1.24 + xi    = g->lon 
    1.25 + yi    = g->lat
    1.26 +
    1.27 +;************************************************
    1.28 +; change into 0-360E, 90S-90N
    1.29 +; Observed NPP*scale_factor
    1.30 +;************************************************
    1.31 +
    1.32 + scale_factor = 0.1
    1.33 + 
    1.34 + yi    = (/ yi(::-1) /)
    1.35 + bi    =  (/ bi(::-1,:) /)
    1.36 + b2    = bi
    1.37 + x2    = xi   
    1.38 + 
    1.39 + nx = dimsizes(xi)
    1.40 + do i= 0,nx-1
    1.41 +    if (i .lt. 3600) then
    1.42 +       p = i + 3600
    1.43 +       xi(p) = x2(i) + 360.      
    1.44 +    else
    1.45 +       p = i - 3600
    1.46 +       xi(p) = x2(i)
    1.47 +    end if
    1.48 +    bi(:,p)= b2(:,i) * scale_factor
    1.49 + end do
    1.50 +
    1.51 +;print (xi)
    1.52 +;print (yi)
    1.53 +;exit
    1.54 +
    1.55 +;************************************************
    1.56 +; read in model data
    1.57 +;************************************************
    1.58 + f     = addfile ("i01.03cn_1545-1569_ANN_climo.nc","r")
    1.59 +;f     = addfile ("i01.04casa_1605-1629_ANN_climo.nc","r")
    1.60 + 
    1.61 + xo    = f->lon     
    1.62 + yo    = f->lat      
    1.63 +
    1.64 +; print (xi)
    1.65 +; print (yi)
    1.66 +; print (xo)
    1.67 +; print (yo)
    1.68 +
    1.69 + bo = linint2_Wrap(xi,yi,bi,True,xo,yo,0) 
    1.70 + 
    1.71 +  bo!0   = "lat"
    1.72 +  bo!1   = "lon"
    1.73 +  bo&lat =  yo
    1.74 +  bo&lon =  xo
    1.75 +  bo@units      = bi@units
    1.76 +  bo@long_name  = bi@long_name
    1.77 +  bo@_FillValue = bi@_FillValue
    1.78 +
    1.79 +  c->NPP  = bo
    1.80 +end
    1.81 \ No newline at end of file