source: trunk/src/sst_correction_ncdf.pro @ 17

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

fix for graph in PDF

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