[1768] | 1 | #v2=better management of memory for large resolution |
---|
| 2 | |
---|
| 3 | #RES=48x36 |
---|
| 4 | #RES=96x95 |
---|
| 5 | RES=144x142 |
---|
| 6 | |
---|
| 7 | #enlarge Sato file into a lat-lon field |
---|
| 8 | cdo enlarge,GRID/grid-giss-enlarged INPUT/tau_zm_NOAA-GISS.nc tmp0.nc |
---|
| 9 | |
---|
| 10 | #remap enlarged lat-lon field onto LMDZ CMIP5 grid |
---|
| 11 | cdo remapcon,GRID/grid-lmdz-lonlat_${RES} tmp0.nc tmp1.nc |
---|
| 12 | |
---|
| 13 | #regridding on the vertical |
---|
| 14 | rm -f regrid.pro |
---|
| 15 | cat << eod >> regrid.pro |
---|
| 16 | pro regrid |
---|
| 17 | filename1='tmp1.nc' |
---|
| 18 | NETCDFREAD,filename1,'tau',TAU |
---|
| 19 | NETCDFREAD,filename1,'lat',lat,dimlat0 |
---|
| 20 | NETCDFREAD,filename1,'lon',lon,dimlon0 |
---|
| 21 | NETCDFREAD,filename1,'time',time,dimtime0 |
---|
| 22 | NETCDFREAD,filename1,'altitude',altitude,dimaltitude |
---|
| 23 | dimlat=dimlat0(0) |
---|
| 24 | dimlon=dimlon0(0) |
---|
| 25 | dimtime=dimtime0(0) |
---|
| 26 | month_in_year=12 |
---|
| 27 | ; |
---|
| 28 | ;---approximate altitudes of LMDZ -L39 |
---|
| 29 | dimz=39 |
---|
| 30 | zz=fltarr(dimz) |
---|
| 31 | zz=[0.0338988, 0.1106602, 0.2139233, 0.3609663, 0.5685416, 0.8534464, $ |
---|
| 32 | 1.233232, 1.726868, 2.355076, 3.139813, 4.101937, 5.25541, 6.596076, $ |
---|
| 33 | 8.085103, 9.636482, 11.13441, 12.50023, 13.75765, 15.00424, 16.32207, $ |
---|
| 34 | 17.74403, 19.27899, 20.93219, 22.70941, 24.61736, 26.66389, 28.85831, $ |
---|
| 35 | 31.21178, 33.73778, 36.45278, 39.37709, 42.53607, 45.96209, 49.69786, $ |
---|
| 36 | 53.80379, 58.37727, 63.61497, 70.07092, 80.52708] |
---|
| 37 | zzi=fltarr(dimz+1) |
---|
| 38 | zzi(0)=0.0 |
---|
| 39 | for k=1, dimz-1 do begin |
---|
| 40 | zzi(k)=(zz(k-1)+zz(k))/2.0 |
---|
| 41 | endfor |
---|
| 42 | zzi(dimz)=100.00 |
---|
| 43 | print, 'zzi=',zzi |
---|
| 44 | lev=indgen(dimz)+1 |
---|
| 45 | ; |
---|
| 46 | dimzori=4 |
---|
| 47 | zziori=fltarr(dimzori+1) |
---|
| 48 | zziori=[15.,20.,25.,30.,35.] |
---|
| 49 | ; |
---|
| 50 | tau2=fltarr(dimlon,dimlat,dimz,month_in_year) |
---|
| 51 | ; |
---|
| 52 | for yr=0,dimtime/month_in_year-1 do begin |
---|
| 53 | ; |
---|
| 54 | tau2(*,*,*,*)=0.0 |
---|
| 55 | chyr=strcompress(1850+yr,/rem) |
---|
| 56 | print,'year=',chyr |
---|
| 57 | ; |
---|
| 58 | for k=0, dimz-1 do begin |
---|
| 59 | for kori=0, dimzori-1 do begin |
---|
| 60 | ;print, 'k=',k,' kori=',kori |
---|
| 61 | ; |
---|
| 62 | ;fraction de la maille kori qui se trouve dans la maille k |
---|
| 63 | frac= max([0.0,min([zzi(k+1),zziori(kori+1)])-max([zzi(k),zziori(kori)])])/(zziori(kori+1)-zziori(kori)) |
---|
| 64 | ; |
---|
| 65 | ;regridding |
---|
| 66 | for i=0,dimlon-1 do begin |
---|
| 67 | for j=0,dimlat-1 do begin |
---|
| 68 | for l=0,month_in_year-1 do begin |
---|
| 69 | tau2(i,j,k,l)=tau2(i,j,k,l)+tau(i,j,kori,yr*month_in_year+l)*frac |
---|
| 70 | endfor |
---|
| 71 | endfor |
---|
| 72 | endfor |
---|
| 73 | ; |
---|
| 74 | endfor |
---|
| 75 | endfor |
---|
| 76 | ; |
---|
| 77 | ;saving netcdf file |
---|
| 78 | ; |
---|
| 79 | taustruct={lon:fltarr(dimlon),lat:fltarr(dimlat), $ |
---|
| 80 | lev:fltarr(dimz),time:fltarr(month_in_year), $ |
---|
| 81 | taustrat:fltarr(dimlon,dimlat,dimz,month_in_year) } |
---|
| 82 | ; |
---|
| 83 | taustruct.lon=lon |
---|
| 84 | taustruct.lat=lat |
---|
| 85 | taustruct.lev=lev |
---|
| 86 | taustruct.time=float(indgen(month_in_year)+1) |
---|
| 87 | taustruct.taustrat=tau2 |
---|
| 88 | ; |
---|
| 89 | attributes = {units:strarr(5),long_name:strarr(5)} |
---|
| 90 | attributes.units = ['degrees_east','degrees_north','level','month','taustrat'] |
---|
| 91 | attributes.long_name = ['longitude','latitude','level', 'time', 'TAUSTRAT'] |
---|
| 92 | ; |
---|
| 93 | dimensions = {isdim:intarr(5), links:intarr(4,5)} |
---|
| 94 | dimensions.isdim = [1,1,1,1,0] ; (1=dimension, 0=variable) |
---|
| 95 | dimensions.links = [ [-1,-1,-1,-1],[-1,-1,-1,-1], $ |
---|
| 96 | [-1,-1,-1,-1],[-1,-1,-1,-1], $ |
---|
| 97 | [0,1,2,3] ] |
---|
| 98 | ; |
---|
| 99 | netcdfwrite,'/tmp15/obolmd/STRAT/OUTPUT_${RES}/taustrat.'+chyr+'.nc',taustruct,clobber=1, $ |
---|
| 100 | attributes=attributes, dimensions=dimensions |
---|
| 101 | ; |
---|
| 102 | endfor |
---|
| 103 | ; |
---|
| 104 | end |
---|
| 105 | eod |
---|
| 106 | # |
---|
| 107 | #--calling IDL |
---|
| 108 | # |
---|
| 109 | /opt/idl-6.4/idl/bin/idl << eod |
---|
| 110 | .r netcdf |
---|
| 111 | .r regrid |
---|
| 112 | regrid |
---|
| 113 | exit |
---|
| 114 | eod |
---|
| 115 | # |
---|
| 116 | # |
---|
| 117 | rm -f tmp0.nc tmp1.nc regrid.pro |
---|