source: trunk/src/sst_correction_ncdf.pro @ 6

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

minimal header in .pro

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