source: trunk/mesoscale/LMD_MM_MARS/SRC/PREP_MARS/concatoxf.pro @ 87

Last change on this file since 87 was 11, checked in by aslmd, 14 years ago

spiga@svn-planeto:ajoute le modele meso-echelle martien

File size: 3.2 KB
Line 
1pro concatoxf
2
3;------------------------------------
4file1='input_totoptdep1.nc'
5file2='input_totoptdep2.nc'
6;------------------------------------
7
8cdfid1 = ncdf_open(file1)
9cdfid2 = ncdf_open(file2)
10
11; coordinates
12varid=ncdf_varid(cdfid1,'lat')
13        ncdf_varget, cdfid1, varid, lati
14lat=n_elements(lati)
15
16varid=ncdf_varid(cdfid1,'lon')
17        ncdf_varget, cdfid1, varid, longi
18lon=n_elements(longi)
19
20varid=ncdf_varid(cdfid1,'time')
21        ncdf_varget, cdfid1, varid, time1
22varid=ncdf_varid(cdfid2,'time')
23        ncdf_varget, cdfid2, varid, time2
24t1=n_elements(time1)
25t2=n_elements(time2)
26
27; concat time coordinates
28ntime=t1+t2
29timear=fltarr(ntime)
30timear(0:t1-1)=time1(0:t1-1)
31timear(t1:ntime-1)=time2(0:t2-1)+time1(t1-1)
32
33
34; field
35varid=ncdf_varid(cdfid1,'totoptdep')
36        ncdf_varget, cdfid1, varid, totoptdep1
37varid=ncdf_varid(cdfid2,'totoptdep')
38        ncdf_varget, cdfid2, varid, totoptdep2
39
40
41;loadct, 3
42;!p.multi=[0,1,3]
43;ref=totoptdep1(*,*,tata)
44;smo=smooth(ref,toto)
45;err=100.*abs(ref-smo)/ref
46;err=(ref-smo)
47;print, max(err), ref(where(err eq max(err)))
48;contour, err, nlevels=40, /cell_fill
49;contour, ref, nlevels=40, /cell_fill
50;contour, smo, nlevels=40, /cell_fill
51;stop
52
53
54
55; concat field
56totoptdep=fltarr(lon,lat,ntime)
57totoptdep(*,*,0:t1-1)=totoptdep1(*,*,*)
58totoptdep(*,*,t1:ntime-1)=totoptdep2(*,*,*)
59fieldname1='totoptdep'
60outfieldstring1='Total dust  optical depth (tauref/700Pa)'
61unit1='Opacity/Pa'
62
63
64
65;;;*********************************************************************
66
67;
68; SMOOTH wrt SPACE
69;
70totoptdep=smooth(totoptdep,2)
71
72
73;
74; INTERPOLATE wrt TIME
75;
76
77which_utc_is_TES=3
78;; for Hellas 8AM is 02PM LT, i.e. TES measurements
79;; IDL convention, starts 0 !!!!
80
81
82nday=floor(float(ntime-1)/12.)-1
83
84ref=fltarr(nday)
85subsarr=fltarr(nday)
86
87for i=0, n_elements(totoptdep(*,0,0))-1 do begin
88        for j=0, n_elements(totoptdep(0,*,0))-1 do begin
89                for each=0,nday-1 do begin
90                        subs=each*12 + which_utc_is_TES
91                        ref(each)=totoptdep(i,j,subs)
92                        subsarr(each)=subs
93                endfor
94                ;;yeah=interpol(ref,subsarr,findgen(ntime), /spline)
95                yeah=interpol(ref,subsarr,findgen(ntime) )
96                totoptdep(i,j,*)=yeah
97        endfor
98endfor
99
100;;;*********************************************************************
101
102
103
104
105
106;--------------------------------
107print,'writing netcdf file'
108
109filencdf='input_totoptdep_tot.nc'
110cdfid=ncdf_create(filencdf,/clobber)
111
112londimid=ncdf_dimdef(cdfid,'lon',lon)
113latdimid=ncdf_dimdef(cdfid,'lat',lat)
114tdimid=ncdf_dimdef(cdfid,'time',ntime)
115lonid=ncdf_vardef(cdfid,'lon',[londimid],/float)
116ncdf_attput,cdfid,lonid,'long_name','longitude'
117ncdf_attput,cdfid,lonid,'units','degrees_east'
118latid=ncdf_vardef(cdfid,'lat',[latdimid],/float)
119ncdf_attput,cdfid,latid,'long_name','latitude'
120ncdf_attput,cdfid,latid,'units','degrees_north'
121timeid=ncdf_vardef(cdfid,'time',[tdimid],/float)
122ncdf_attput,cdfid,timeid,'long_name','model time'
123ncdf_attput,cdfid,timeid,'units','hours since 00:00:00'
124varid1=ncdf_vardef(cdfid,fieldname1,[londimid,latdimid,tdimid],/float)
125ncdf_attput,cdfid,varid1,'Physics_diagnostic',outfieldstring1
126ncdf_attput,cdfid,varid1,'units',unit1
127ncdf_control,cdfid,/endef
128
129ncdf_varput,cdfid,lonid,longi
130ncdf_varput,cdfid,latid,lati
131ncdf_varput,cdfid,timeid,timear
132ncdf_varput,cdfid,varid1,totoptdep
133
134ncdf_close,cdfid
135
136end
Note: See TracBrowser for help on using the repository browser.