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