npp/42.bias_normalized.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
; xy_4.ncl
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 data
forrest@0
    11
;************************************************
forrest@0
    12
 g     = addfile ("data.81.nc","r")
forrest@0
    13
 a     = g->SITE_ID  
forrest@0
    14
 xo    = g->LONG_DD  
forrest@0
    15
 yo    = g->LAT_DD
forrest@0
    16
 c     = g->TNPP_C
forrest@0
    17
;c     = g->ANPP_C
forrest@0
    18
;c     = g->BNPP_C
forrest@0
    19
 cp    = g->PREC_ANN
forrest@0
    20
 do i= 0,dimsizes(cp)-1
forrest@0
    21
 if (ismissing(cp(i))) then
forrest@0
    22
    cp (i) = 100
forrest@0
    23
 end if
forrest@0
    24
 end do  
forrest@0
    25
 d     = int2flt(c)/int2flt(cp)
forrest@0
    26
 print (d)
forrest@0
    27
forrest@0
    28
 nx = dimsizes(xo)
forrest@0
    29
 do i= 0,nx-1
forrest@0
    30
    if (xo(i) .lt. 0.) then
forrest@0
    31
        xo(i) = xo(i)+ 360.
forrest@0
    32
    end if
forrest@0
    33
 end do
forrest@0
    34
;print (xo)
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
 b     = f->NPP
forrest@0
    39
;b     = f->AGNPP
forrest@0
    40
;b     = f->BGNPP    
forrest@0
    41
 xi    = f->lon     
forrest@0
    42
 yi    = f->lat
forrest@0
    43
 bp    = f->RAIN      
forrest@0
    44
forrest@0
    45
 sec_to_year = 86400.*365.
forrest@0
    46
forrest@0
    47
 bo = linint2_points(xi,yi,b,True,xo,yo,0) * sec_to_year
forrest@0
    48
;print (bo)
forrest@0
    49
 bq = linint2_points(xi,yi,bp,True,xo,yo,0) * sec_to_year 
forrest@0
    50
forrest@0
    51
 bo = bo/bq
forrest@0
    52
 
forrest@0
    53
 ccr = esccr(bo,d,0)
forrest@0
    54
 print (ccr)
forrest@0
    55
 bias = sum(((bo(0,:)-d(:))/d(:))^2)
forrest@0
    56
 print (bias)
forrest@0
    57
 M    = 1. - sqrt(bias/nx)
forrest@0
    58
 print (M)
forrest@0
    59
forrest@0
    60
end