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