|
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: observed |
|
11 ;************************************************ |
|
12 diri = "/fis/cgd/cseg/people/jeff/clamp_data/co2/" |
|
13 fili = "co2_globalView_222.nc" |
|
14 g = addfile (diri+fili,"r") |
|
15 val = g->CO2_SEAS |
|
16 lon = g->LON |
|
17 lat = g->LAT |
|
18 delete (g) |
|
19 |
|
20 ncase = dimsizes(lat) |
|
21 ;print (ncase) |
|
22 |
|
23 ;************************************************************** |
|
24 ; get only the lowest level at each station |
|
25 ;************************************************************** |
|
26 lat_tmp = lat |
|
27 lat_tmp@_FillValue = 1.e+36 |
|
28 |
|
29 do n = 0,ncase-1 |
|
30 if (.not. ismissing(lat_tmp(n))) then |
|
31 indexes = ind(lat(n) .eq. lat .and. lon(n) .eq. lon) |
|
32 if (dimsizes(indexes) .gt. 1) then |
|
33 lat_tmp(indexes(1:)) = lat_tmp@_FillValue |
|
34 end if |
|
35 delete (indexes) |
|
36 end if |
|
37 end do |
|
38 |
|
39 indexes = ind(.not. ismissing(lat_tmp)) |
|
40 ;print (indexes) |
|
41 |
|
42 lat_ob = lat(indexes) |
|
43 lon_ob = lon(indexes) |
|
44 val_ob = val(indexes,:) |
|
45 ;printVarSummary (val_ob) |
|
46 ;print (lat_ob +"/"+lon_ob) |
|
47 |
|
48 ;************************************************ |
|
49 ; read in model data |
|
50 ;************************************************ |
|
51 diri2 = "/fis/cgd/cseg/people/jeff/clamp_data/model/" |
|
52 fili2 = "b30.061m_401_425_MONS_climo.nc" |
|
53 |
|
54 g = addfile(diri2+fili2,"r") |
|
55 x = g->CO2 |
|
56 xi = g->lon |
|
57 yi = g->lat |
|
58 xdim = dimsizes(x) |
|
59 nlev = xdim(1) |
|
60 y = x(:,0,:,:) |
|
61 ; printVarSummary (y) |
|
62 |
|
63 ; get the co2 at the lowest level |
|
64 y = x(:,nlev-1,:,:) |
|
65 |
|
66 ; change to unit of observed (u mol/mol) |
|
67 ; Model_units [=] kgCO2 / kgDryAir |
|
68 ; 28.966 = molecular weight of dry air |
|
69 ; 44. = molecular weight of CO2 |
|
70 ; u mol = 1e-6 mol |
|
71 |
|
72 factor = (28.966/44.) * 1e6 |
|
73 y = y * factor |
|
74 |
|
75 y@_FillValue = 1.e36 |
|
76 y@units = "u mol/mol" |
|
77 ; y = where(y0 .lt. 287.,y@_FillValue,y) |
|
78 ; printVarSummary (y) |
|
79 ; print (min(y)+"/"+max(y)) |
|
80 |
|
81 ; interpolate into observed station |
|
82 |
|
83 yo = linint2_points_Wrap(xi,yi,y,True,lon_ob,lat_ob,0) |
|
84 |
|
85 val_model = val_ob |
|
86 val_model = yo(pts|:,time|:) |
|
87 printVarSummary (val_model) |
|
88 print (min(val_model)+"/"+max(val_model)) |
|
89 |
|
90 ; remove annual mean |
|
91 val_model = val_model - conform(val_model,dim_avg(val_model),0) |
|
92 print (min(val_model)+"/"+max(val_model)) |
|
93 exit |
|
94 ;************************************************************** |
|
95 ; get stations of 60N-90N |
|
96 ;************************************************************** |
|
97 |
|
98 ind_1 = ind(lat_new .gt. 60.) |
|
99 print (ind_1) |
|
100 print (lat_new(ind_1)+"/"+lon_new(ind_1)) |
|
101 print (val_new(ind_1(0),:)) |
|
102 exit |
|
103 |
|
104 end |