npp/03.0.05deg_to_T42.ncl.0
author Forrest Hoffman <forrest@climatemodeling.org>
Mon, 26 Jan 2009 22:08:20 -0500
changeset 0 0c6405ab2ff4
permissions -rw-r--r--
Initial commit of C-LAMP Diagnostics from Jeff Lee
     1 ; ***********************************************
     2 ; interpolate into model grids (T31)
     3 ; ***********************************************
     4 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
     5 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
     6 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
     7 ;************************************************
     8 begin
     9 ;************************************************
    10 ; output data
    11 ;************************************************
    12   diro  = "/fis/cgd/cseg/people/jeff/clamp/"
    13   filo  = "Npp_T31_mean.nc"
    14   c = addfile(diro+filo,"c")
    15 
    16 ;************************************************
    17 ; read in observed data
    18 ;************************************************
    19  g     = addfile ("Npp_0.05deg_mean.nc","r")
    20  bi    = g->NPP   
    21  xi    = g->lon 
    22  yi    = g->lat
    23 
    24 ;************************************************
    25 ; change into 0-360E, 90S-90N
    26 ; Observed NPP*scale_factor
    27 ;************************************************
    28 
    29  scale_factor = 0.1
    30  
    31  yi    = (/ yi(::-1) /)
    32  bi    =  (/ bi(::-1,:) /)
    33  b2    = bi
    34  x2    = xi   
    35  
    36  nx = dimsizes(xi)
    37  do i= 0,nx-1
    38     if (i .lt. 3600) then
    39        p = i + 3600
    40        xi(p) = x2(i) + 360.      
    41     else
    42        p = i - 3600
    43        xi(p) = x2(i)
    44     end if
    45     bi(:,p)= b2(:,i) * scale_factor
    46  end do
    47 
    48 ;print (xi)
    49 ;print (yi)
    50 ;exit
    51 
    52 ;************************************************
    53 ; read in model data
    54 ;************************************************
    55  f     = addfile ("i01.03cn_1545-1569_ANN_climo.nc","r")
    56 ;f     = addfile ("i01.04casa_1605-1629_ANN_climo.nc","r")
    57  
    58  xo    = f->lon     
    59  yo    = f->lat      
    60 
    61 ; print (xi)
    62 ; print (yi)
    63 ; print (xo)
    64 ; print (yo)
    65 
    66  bo = linint2_Wrap(xi,yi,bi,True,xo,yo,0) 
    67  
    68   bo!0   = "lat"
    69   bo!1   = "lon"
    70   bo&lat =  yo
    71   bo&lon =  xo
    72   bo@units      = bi@units
    73   bo@long_name  = bi@long_name
    74   bo@_FillValue = bi@_FillValue
    75 
    76   c->NPP  = bo
    77 end