npp/52.zonavg_to_T31.ncl
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
; zonal average plot
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
; read in observed data
forrest@0
    11
;************************************************
forrest@0
    12
 g     = addfile ("Npp_0.05deg_mean.nc","r")
forrest@0
    13
 bi    = g->NPP   
forrest@0
    14
 xi    = g->lon 
forrest@0
    15
 yi    = g->lat
forrest@0
    16
 yi    = (/ yi(::-1) /)
forrest@0
    17
 bi    =  (/ bi(::-1,:) /)
forrest@0
    18
 b2    = bi
forrest@0
    19
 x2    = xi   
forrest@0
    20
 
forrest@0
    21
 nx = dimsizes(xi)
forrest@0
    22
 do i= 0,nx-1
forrest@0
    23
    if (i .lt. 3600) then
forrest@0
    24
       p = i + 3600
forrest@0
    25
       xi(p) = x2(i) + 360.      
forrest@0
    26
    else
forrest@0
    27
       p = i - 3600
forrest@0
    28
       xi(p) = x2(i)
forrest@0
    29
    end if
forrest@0
    30
    bi(:,p)= b2(:,i) 
forrest@0
    31
 end do
forrest@0
    32
;print (xi)
forrest@0
    33
;print (yi)
forrest@0
    34
;exit
forrest@0
    35
forrest@0
    36
 f     = addfile ("i01.03cn_1545-1569_ANN_climo.nc","r")
forrest@0
    37
;f     = addfile ("i01.04casa_1605-1629_ANN_climo.nc","r")
forrest@0
    38
forrest@0
    39
 xo    = f->lon     
forrest@0
    40
 yo    = f->lat      
forrest@0
    41
forrest@0
    42
 print (xi)
forrest@0
    43
 print (yi)
forrest@0
    44
 print (xo)
forrest@0
    45
 print (yo)
forrest@0
    46
forrest@0
    47
 bo = linint2_Wrap(xi,yi,bi,True,xo,yo,0) 
forrest@0
    48
 
forrest@0
    49
 v = zonalAve(bo)
forrest@0
    50
forrest@0
    51
 v@long_name = "NPP (gC/m2/year)"
forrest@0
    52
 
forrest@0
    53
;************************************************
forrest@0
    54
; plotting parameters
forrest@0
    55
;************************************************
forrest@0
    56
 wks   = gsn_open_wks ("png","xy")                ; open workstation
forrest@0
    57
forrest@0
    58
 res                  = True                     ; plot mods desired
forrest@0
    59
 res@tiMainString     = "Observed T31"          ; add title
forrest@0
    60
forrest@0
    61
 plot  = gsn_csm_xy (wks,v&lat,v,res) 
forrest@0
    62
end