npp/12.scatter.linint2_points.ncl
author Forrest Hoffman <forrest@climatemodeling.org>
Thu, 26 Mar 2009 14:02:21 -0400
changeset 1 4be95183fbcd
permissions -rw-r--r--
Modifications to scoring and graphics production for the final version of code for the C-LAMP paper in GCB.
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
;************************************************
forrest@0
     7
begin
forrest@0
     8
;************************************************
forrest@0
     9
; read in data
forrest@0
    10
;************************************************
forrest@0
    11
 g     = addfile ("data.81.nc","r")
forrest@0
    12
;g     = addfile ("data.933.nc","r")
forrest@0
    13
 a     = g->SITE_ID  ; get ob data
forrest@0
    14
 xo    = g->LONG_DD  ; get ob data
forrest@0
    15
 yo    = g->LAT_DD   ; get ob data
forrest@0
    16
forrest@0
    17
 print (xo)
forrest@0
    18
 nx = dimsizes(xo)
forrest@0
    19
 do i= 0,nx-1
forrest@0
    20
    if (xo(i) .lt. 0.) then
forrest@0
    21
        xo(i) = xo(i)+ 360.
forrest@0
    22
    end if
forrest@0
    23
 end do
forrest@0
    24
 print (xo)
forrest@0
    25
forrest@0
    26
 a@long_name = "SITE_ID"
forrest@0
    27
 
forrest@0
    28
;f     = addfile ("i01.03cn_1545-1569_ANN_climo.nc","r")
forrest@0
    29
 f     = addfile ("i01.04casa_1605-1629_ANN_climo.nc","r")
forrest@0
    30
 b     = f->NPP    ; get model data
forrest@0
    31
 xi    = f->lon      ; get model data
forrest@0
    32
 yi    = f->lat      ; get model data
forrest@0
    33
forrest@0
    34
 sec_to_year = 86400.*365.
forrest@0
    35
forrest@0
    36
 bo = linint2_points(xi,yi,b,True,xo,yo,0) * sec_to_year
forrest@0
    37
 print (bo)
forrest@0
    38
forrest@0
    39
 bo@long_name = "NPP (gC/m2/year)"
forrest@0
    40
 
forrest@0
    41
;************************************************
forrest@0
    42
; plotting parameters
forrest@0
    43
;************************************************
forrest@0
    44
;wks   = gsn_open_wks ("ps","xy")                 ; open workstation
forrest@0
    45
 wks   = gsn_open_wks ("png","xy")
forrest@0
    46
forrest@0
    47
 res                   = True                     ; plot mods desired
forrest@0
    48
;res@tiMainString      = "Model i01.03cn 81 sites"     ; add title
forrest@0
    49
;res@tiMainString      = "Model i01.03cn 933 sites"    ; add title
forrest@0
    50
 res@tiMainString      = "Model i01.04casa 81 sites"   ; add title
forrest@0
    51
;res@tiMainString      = "Model i01.04casa 933 sites"  ; add title
forrest@0
    52
 res@xyMarkLineModes   = "Markers"                ; choose which have markers
forrest@0
    53
 res@xyMarkers         =  16                      ; choose type of marker  
forrest@0
    54
 res@xyMarkerColor     = "red"                    ; Marker color
forrest@0
    55
 res@xyMarkerSizeF     = 0.01                     ; Marker size (default 0.01)
forrest@0
    56
forrest@0
    57
 res@tmLabelAutoStride = True                     ; nice tick mark labels
forrest@0
    58
forrest@0
    59
;plot  = gsn_csm_xy (wks,t&nvalues,t(:),res) ; create plot
forrest@0
    60
 plot  = gsn_csm_xy (wks,a,bo,res) ; create plot
forrest@0
    61
forrest@0
    62
;************************************************
forrest@0
    63
; now create our own markers using NhlNewMarker 
forrest@0
    64
; available since ncl version 4.2.0.a030
forrest@0
    65
;************************************************
forrest@0
    66
; this example will create filled squares. You will have to play with
forrest@0
    67
; the numbers a but to get the size and shape you desire. On the
forrest@0
    68
; documentation page for NhlNewMarker, there is a table of values for
forrest@0
    69
; the current marker set, to give you an idea of where to start.
forrest@0
    70
forrest@0
    71
;  res@xyMarkerColor = "blue"
forrest@0
    72
;  res@tiMainString  = "Make your own marker"
forrest@0
    73
;  res@xyMarkers     = NhlNewMarker(wks, "^", 19, 0.0, 0.0, 1.3125, 1.5, 0.0)
forrest@0
    74
;  plot              = gsn_csm_xy (wks,a,bo,res) 
forrest@0
    75
forrest@0
    76
end