source: trunk/src/sst_correction_ncdf.pro @ 9

Last change on this file since 9 was 9, checked in by pinsard, 13 years ago

add some graph - io - in headers (cont.)

File size: 3.3 KB
Line 
1;+
2;
3; .. sst_correction_ncdf.pro:
4;
5; =======================
6; sst_correction_ncdf.pro
7; =======================
8;
9; .. only:: man
10;
11; Figure is visible on PDF and HTML documents only.
12;
13; .. only:: html
14;
15;     .. graphviz::
16;
17;        digraph sst_correction_ncdf {
18;           graph [
19;           rankdir="LR",
20;           ]
21;
22;           file_sst [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_sst_19890101_20091231_oafluxgrid.nc"];
23;
24;           ncfile [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_cor/full_cor/TropFlux_sst_19890101_20091231_v20.nc"];
25;
26;           sst_correction_ncdf [shape=box,
27;           fontname=Courier,
28;           color=blue,
29;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/sst_correction_ncdf.pro",
30;           label="${TROPFLUX}/src/sst_correction_ncdf.pro"];
31;
32;           {file_sst} -> {sst_correction_ncdf} -> {ncfile}
33;
34;        }
35;
36;
37; SEE ALSO
38; ========
39;
40; EXAMPLES
41; ========
42;
43; ::
44;
45;  IDL> sst_correction_ncdf
46;
47; TODO
48; ====
49;
50; hard coded directory - usage of ${TROPFLUX_ID}
51;
52; coding rules
53;
54; EVOLUTIONS
55; ==========
56;
57; - fplod 20101215T114224Z aedon.locean-ipsl.upmc.fr (Darwin)
58;
59;   * add graph in header
60;
61; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin)
62;
63;   * minimal header
64;
65; - pbk 2008
66;
67;   * creation
68;
69;-
70pro sst_correction_ncdf
71@common
72da1=19880101 & da2=20091231
73
74file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_sst_19890101_20091231_oafluxgrid.nc'
75initncdf, file
76sst=read_ncdf('sst',da1,da2,file=file,/nostr) & sst=sst-273.15
77help, sst
78
79sst_mean=grossemoyenne(sst,'t',/nan)
80help, sst_mean
81
82tt=time & jpt=n_elements(time)
83caldat, time,mon,day,yea
84sst_m=sst*0.
85
86for jt=0,jpt-1 do begin
87  jtt=(time(jt)-julday(1,1,yea(jt))) < 364
88  t=reform(sst_mean(*,*))
89  sst_m(*,*,jt)=t
90endfor
91help, sst_m
92
93sst_ano=sst-sst_m
94
95;; correction for mean based on scatter
96;sst_m=sst_m+0.0521111   ;; (2000-2008)
97sst_m=sst_m+0.0533692    ;; (2000-2009)
98
99help, sst_ano
100
101;; applying the correction for varyability based on the scatter
102;sst_ano=sst_ano*(1/0.989889)  ;; (2000-2008)
103sst_ano=sst_ano*(1/0.986196)   ;; (2000-2009)
104
105sst_new=sst_m+sst_ano+273.15
106help, sst_new
107
108;writing field
109lat=reform(gphit(0,0:jpj-1))
110lon=reform(glamt(0:jpi-1,0))
111time=timegen(7670, units='days', start=julday(1,1,1989)) & jpt=n_elements(time)
112
113cda0=string(jul2date(time(0)),format='(i8.8)')
114cda1=string(jul2date(time(jpt-1)),format='(i8.8)')
115
116time=time-julday(1,1,1950) & jpt=n_elements(time)
117
118ncfile='!/Volumes/PRAVEEN/TropFlux/input_cor/full_cor/TropFlux_sst_19890101_20091231_v20.nc'
119lon_attr={units:'degrees_east',long_name:'Longitude'}
120lat_attr={units:'degrees_north',long_name:'Latitude'}
121time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:'1950-JAN-01 00:00:00'}
122sst_attr={units:'degK',missing_value:1.e20,long_name:'Sea Surface Temperature',short_name:'sst',axis:'TYX'}
123globattr={source:'Basic data obtained from ERAI.  Bias and variability correction are applied',timerange:cda0+' - '+cda1}
124
125
126ncfields = 'sst[longitude,latitude,time]=sst_new:sst_attr; ' $
127                      + 'longitude[]=lon:lon_attr; ' $
128                      + 'latitude[]=lat:lat_attr; ' $
129                      + 'time[*time]=time:time_attr ' $
130                      + ' @ globattr'
131
132@ncdf_quickwrite
133
134end
Note: See TracBrowser for help on using the repository browser.