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