1 | ;+ |
---|
2 | ; |
---|
3 | ; .. _interp_erai_sst_1989_2009.pro: |
---|
4 | ; |
---|
5 | ; ============================= |
---|
6 | ; interp_erai_sst_1989_2009.pro |
---|
7 | ; ============================= |
---|
8 | ; |
---|
9 | ; SEE ALSO |
---|
10 | ; ======== |
---|
11 | ; |
---|
12 | ; EXAMPLES |
---|
13 | ; ======== |
---|
14 | ; |
---|
15 | ; :: |
---|
16 | ; |
---|
17 | ; IDL> interp_erai_sst_1989_2009 |
---|
18 | ; |
---|
19 | ; TODO |
---|
20 | ; ==== |
---|
21 | ; |
---|
22 | ; hard coded directory - usage of ${TROPFLUX_ID} |
---|
23 | ; |
---|
24 | ; coding rules |
---|
25 | ; |
---|
26 | ; EVOLUTIONS |
---|
27 | ; ========== |
---|
28 | ; |
---|
29 | ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
30 | ; |
---|
31 | ; * minimal header |
---|
32 | ; |
---|
33 | ; - pbk 2008 |
---|
34 | ; |
---|
35 | ; |
---|
36 | ; * creation |
---|
37 | ; |
---|
38 | ;- |
---|
39 | pro interp_erai_sst_1989_2009 |
---|
40 | @common |
---|
41 | |
---|
42 | filein='/Volumes/PRAVEEN/ERAI_global/20c3m_erai_sstk_TROP_1989_2009.nc' |
---|
43 | gridout='/Volumes/PRAVEEN/work/flux_reconstruction/gridded_data/mask_oaflux_30N30S.nc' |
---|
44 | |
---|
45 | initncdf, filein |
---|
46 | domdef |
---|
47 | latin=reform(gphit(0,*)) & lonin=reform(glamt(*,0)) |
---|
48 | print, 'lat grid ',min(latin),max(latin),latin(1)-latin(0) |
---|
49 | print, 'lon grid ',min(lonin),max(lonin),lonin(1)-lonin(0) |
---|
50 | sstkin=read_ncdf("sstk",19871201,20100930,file=filein,/nostr) |
---|
51 | |
---|
52 | timein=time & jptin=jpt |
---|
53 | tab=sstkin(*,*,0) |
---|
54 | mskin=glamt*0.+1. & ind=where((tab eq 1.e9) or finite(tab,/nan)) & mskin(ind)=0. |
---|
55 | ;mskin=glamt*0.+1. |
---|
56 | |
---|
57 | initncdf, gridout |
---|
58 | domdef |
---|
59 | latout=reform(gphit(0,*)) & lonout=reform(glamt(*,0)) |
---|
60 | print, 'lat grid ',min(latout),max(latout),latout(1)-latout(0) |
---|
61 | print, 'lon grid ',min(lonout),max(lonout),lonout(1)-lonout(0) |
---|
62 | mskout=read_ncdf("msk", file=gridout,/nostr) |
---|
63 | ;stop |
---|
64 | help, sstkin,lonin,latin,mskin,lonout,latout,mskout |
---|
65 | |
---|
66 | si=size(sstkin) |
---|
67 | sstkout=fltarr(jpi,jpj,jptin) |
---|
68 | for jt=0,jptin-1 do begin |
---|
69 | print, 'Interpolation jt=',jt,' / ',jptin-1 |
---|
70 | tab=reform(sstkin(*,*,jt)) |
---|
71 | sstkout(*,*,jt)=call_interp2d(tab,lonin,latin,mskin,lonout,latout,method='bilinear') |
---|
72 | sstkout(*,*,jt)=sstkout(*,*,jt)*mskout+(1.-mskout)*1.e20 |
---|
73 | endfor |
---|
74 | |
---|
75 | |
---|
76 | timein=timein & jptin=jpt |
---|
77 | |
---|
78 | initncdf, gridout |
---|
79 | time=timegen(7670, units='days', start=julday(1,1,1989)) & jpt=n_elements(time) |
---|
80 | tt=time |
---|
81 | cda0=string(jul2date(time(0)),format='(i8.8)') |
---|
82 | cda1=string(jul2date(time(jpt-1)),format='(i8.8)') |
---|
83 | timein=timein-julday(1,1,1950,00,00) |
---|
84 | |
---|
85 | lat=latout |
---|
86 | lon=lonout |
---|
87 | ncfile='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_sst_19890101_20091231_oafluxgrid.nc' |
---|
88 | lon_attr={units:'degrees_east',long_name:'Longitude'} |
---|
89 | lat_attr={units:'degrees_north',long_name:'Latitude'} |
---|
90 | time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'} |
---|
91 | sstk_attr={units:'degK',missing_value:1e20,long_name:'Sea Surface Temperature',short_name:'sst',axis:'TYX'} |
---|
92 | globattr={source:'Data are from ECMWF ERA-Interim reanalysis', timerange:cda0+' - '+cda1} |
---|
93 | |
---|
94 | |
---|
95 | ncfields = 'sst[longitude,latitude,time]=sstkout:sstk_attr; ' $ |
---|
96 | + 'longitude[]=lon:lon_attr; ' $ |
---|
97 | + 'latitude[]=lat:lat_attr; ' $ |
---|
98 | + 'time[*time]=timein:time_attr ' $ |
---|
99 | + ' @ globattr' |
---|
100 | |
---|
101 | @ncdf_quickwrite |
---|
102 | |
---|
103 | |
---|
104 | end |
---|