| 1 | pro concatoxf |
|---|
| 2 | |
|---|
| 3 | ;------------------------------------ |
|---|
| 4 | file1='input_totoptdep1.nc' |
|---|
| 5 | file2='input_totoptdep2.nc' |
|---|
| 6 | ;------------------------------------ |
|---|
| 7 | |
|---|
| 8 | cdfid1 = ncdf_open(file1) |
|---|
| 9 | cdfid2 = ncdf_open(file2) |
|---|
| 10 | |
|---|
| 11 | ; coordinates |
|---|
| 12 | varid=ncdf_varid(cdfid1,'lat') |
|---|
| 13 | ncdf_varget, cdfid1, varid, lati |
|---|
| 14 | lat=n_elements(lati) |
|---|
| 15 | |
|---|
| 16 | varid=ncdf_varid(cdfid1,'lon') |
|---|
| 17 | ncdf_varget, cdfid1, varid, longi |
|---|
| 18 | lon=n_elements(longi) |
|---|
| 19 | |
|---|
| 20 | varid=ncdf_varid(cdfid1,'time') |
|---|
| 21 | ncdf_varget, cdfid1, varid, time1 |
|---|
| 22 | varid=ncdf_varid(cdfid2,'time') |
|---|
| 23 | ncdf_varget, cdfid2, varid, time2 |
|---|
| 24 | t1=n_elements(time1) |
|---|
| 25 | t2=n_elements(time2) |
|---|
| 26 | |
|---|
| 27 | ; concat time coordinates |
|---|
| 28 | ntime=t1+t2 |
|---|
| 29 | timear=fltarr(ntime) |
|---|
| 30 | timear(0:t1-1)=time1(0:t1-1) |
|---|
| 31 | timear(t1:ntime-1)=time2(0:t2-1)+time1(t1-1) |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | ; field |
|---|
| 35 | varid=ncdf_varid(cdfid1,'totoptdep') |
|---|
| 36 | ncdf_varget, cdfid1, varid, totoptdep1 |
|---|
| 37 | varid=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 |
|---|
| 56 | totoptdep=fltarr(lon,lat,ntime) |
|---|
| 57 | totoptdep(*,*,0:t1-1)=totoptdep1(*,*,*) |
|---|
| 58 | totoptdep(*,*,t1:ntime-1)=totoptdep2(*,*,*) |
|---|
| 59 | fieldname1='totoptdep' |
|---|
| 60 | outfieldstring1='Total dust optical depth (tauref/700Pa)' |
|---|
| 61 | unit1='Opacity/Pa' |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | ;;;********************************************************************* |
|---|
| 66 | |
|---|
| 67 | ; |
|---|
| 68 | ; SMOOTH wrt SPACE |
|---|
| 69 | ; |
|---|
| 70 | totoptdep=smooth(totoptdep,2) |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | ; |
|---|
| 74 | ; INTERPOLATE wrt TIME |
|---|
| 75 | ; |
|---|
| 76 | |
|---|
| 77 | which_utc_is_TES=3 |
|---|
| 78 | ;; for Hellas 8AM is 02PM LT, i.e. TES measurements |
|---|
| 79 | ;; IDL convention, starts 0 !!!! |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | nday=floor(float(ntime-1)/12.)-1 |
|---|
| 83 | |
|---|
| 84 | ref=fltarr(nday) |
|---|
| 85 | subsarr=fltarr(nday) |
|---|
| 86 | |
|---|
| 87 | for 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 |
|---|
| 98 | endfor |
|---|
| 99 | |
|---|
| 100 | ;;;********************************************************************* |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | |
|---|
| 106 | ;-------------------------------- |
|---|
| 107 | print,'writing netcdf file' |
|---|
| 108 | |
|---|
| 109 | filencdf='input_totoptdep_tot.nc' |
|---|
| 110 | cdfid=ncdf_create(filencdf,/clobber) |
|---|
| 111 | |
|---|
| 112 | londimid=ncdf_dimdef(cdfid,'lon',lon) |
|---|
| 113 | latdimid=ncdf_dimdef(cdfid,'lat',lat) |
|---|
| 114 | tdimid=ncdf_dimdef(cdfid,'time',ntime) |
|---|
| 115 | lonid=ncdf_vardef(cdfid,'lon',[londimid],/float) |
|---|
| 116 | ncdf_attput,cdfid,lonid,'long_name','longitude' |
|---|
| 117 | ncdf_attput,cdfid,lonid,'units','degrees_east' |
|---|
| 118 | latid=ncdf_vardef(cdfid,'lat',[latdimid],/float) |
|---|
| 119 | ncdf_attput,cdfid,latid,'long_name','latitude' |
|---|
| 120 | ncdf_attput,cdfid,latid,'units','degrees_north' |
|---|
| 121 | timeid=ncdf_vardef(cdfid,'time',[tdimid],/float) |
|---|
| 122 | ncdf_attput,cdfid,timeid,'long_name','model time' |
|---|
| 123 | ncdf_attput,cdfid,timeid,'units','hours since 00:00:00' |
|---|
| 124 | varid1=ncdf_vardef(cdfid,fieldname1,[londimid,latdimid,tdimid],/float) |
|---|
| 125 | ncdf_attput,cdfid,varid1,'Physics_diagnostic',outfieldstring1 |
|---|
| 126 | ncdf_attput,cdfid,varid1,'units',unit1 |
|---|
| 127 | ncdf_control,cdfid,/endef |
|---|
| 128 | |
|---|
| 129 | ncdf_varput,cdfid,lonid,longi |
|---|
| 130 | ncdf_varput,cdfid,latid,lati |
|---|
| 131 | ncdf_varput,cdfid,timeid,timear |
|---|
| 132 | ncdf_varput,cdfid,varid1,totoptdep |
|---|
| 133 | |
|---|
| 134 | ncdf_close,cdfid |
|---|
| 135 | |
|---|
| 136 | end |
|---|