************** ALTERE OS PARAMETROS NIVEIS E EXP ******************** niveis=50 exp=KF ****************** dia=5 arqout=exp'_'niveis'N_'dia'dy' dirout='/scratchout/grupos/apgmet/home/joao.araujo/EXP/saida/MEDIA' ************** ABRA TODAS AS DATAS *********************************** 'open ../saida/2018010100/'exp'_'niveis'N_2018010100+2018010612_'dia'dy.ctl' 'open ../saida/2018010200/'exp'_'niveis'N_2018010200+2018010712_'dia'dy.ctl' 'open ../saida/2018010300/'exp'_'niveis'N_2018010300+2018010812_'dia'dy.ctl' 'open ../saida/2018010400/'exp'_'niveis'N_2018010400+2018010912_'dia'dy.ctl' 'open ../saida/2018010500/'exp'_'niveis'N_2018010500+2018011012_'dia'dy.ctl' 'open ../saida/2018010600/'exp'_'niveis'N_2018010600+2018011112_'dia'dy.ctl' 'open ../saida/2018010700/'exp'_'niveis'N_2018010700+2018011212_'dia'dy.ctl' 'open ../saida/2018010800/'exp'_'niveis'N_2018010800+2018011312_'dia'dy.ctl' 'open ../saida/2018010900/'exp'_'niveis'N_2018010900+2018011412_'dia'dy.ctl' 'open ../saida/2018011000/'exp'_'niveis'N_2018011000+2018011512_'dia'dy.ctl' 'open ../saida/2018011100/'exp'_'niveis'N_2018011100+2018011612_'dia'dy.ctl' 'open ../saida/2018011200/'exp'_'niveis'N_2018011200+2018011712_'dia'dy.ctl' 'open ../saida/2018011300/'exp'_'niveis'N_2018011300+2018011812_'dia'dy.ctl' 'open ../saida/2018011400/'exp'_'niveis'N_2018011400+2018011912_'dia'dy.ctl' 'open ../saida/2018011500/'exp'_'niveis'N_2018011500+2018012012_'dia'dy.ctl' 'open ../saida/2018011600/'exp'_'niveis'N_2018011600+2018012112_'dia'dy.ctl' 'open ../saida/2018011700/'exp'_'niveis'N_2018011700+2018012212_'dia'dy.ctl' 'open ../saida/2018011800/'exp'_'niveis'N_2018011800+2018012312_'dia'dy.ctl' 'open ../saida/2018011900/'exp'_'niveis'N_2018011900+2018012412_'dia'dy.ctl' 'open ../saida/2018012000/'exp'_'niveis'N_2018012000+2018012512_'dia'dy.ctl' 'open ../saida/2018012100/'exp'_'niveis'N_2018012100+2018012612_'dia'dy.ctl' 'open ../saida/2018012200/'exp'_'niveis'N_2018012200+2018012712_'dia'dy.ctl' 'open ../saida/2018012300/'exp'_'niveis'N_2018012300+2018012812_'dia'dy.ctl' 'open ../saida/2018012400/'exp'_'niveis'N_2018012400+2018012912_'dia'dy.ctl' 'open ../saida/2018012500/'exp'_'niveis'N_2018012500+2018013012_'dia'dy.ctl' 'open ../saida/2018012600/'exp'_'niveis'N_2018012600+2018013112_'dia'dy.ctl' 'open ../saida/2018012700/'exp'_'niveis'N_2018012700+2018020112_'dia'dy.ctl' 'open ../saida/2018012800/'exp'_'niveis'N_2018012800+2018020212_'dia'dy.ctl' 'open ../saida/2018012900/'exp'_'niveis'N_2018012900+2018020312_'dia'dy.ctl' 'open ../saida/2018013000/'exp'_'niveis'N_2018013000+2018020412_'dia'dy.ctl' 'open ../saida/2018013100/'exp'_'niveis'N_2018013100+2018020512_'dia'dy.ctl' *************** CALCULO DA MEDIA ********************************** 'set x 1 1600' 'set y 1 801' 'set gxout fwrite' 'set fwrite -be -sq 'dirout'/Media_'arqout'.bin' ****************** VARIAVEIS NÍVEIS N ******************************** **************** TEMPERATURA ***************************************** N=1 while(N<=31) 'set z 'N 'd ((tsl.1 + tsl.2 + tsl.3 + tsl.4 + tsl.5 + tsl.6 + tsl.7 + tsl.8 + tsl.9 + tsl.10 + tsl.11 + tsl.12 + tsl.13 + tsl.14 + tsl.15 + tsl.16 + tsl.17 + tsl.18 + tsl.19 + tsl.20 + tsl.21 + tsl.22 + tsl.23 + tsl.24 + tsl.25 + tsl.26 + tsl.27 + tsl.28 + tsl.29 + tsl.30 + tsl.31)/31)' N=N+1 endwhile *************** U COMP. ******************************************** N=1 while(N<=31) 'set z 'N 'd ((usp.1 + usp.2 + usp.3 + usp.4 + usp.5 + usp.6 + usp.7 + usp.8 + usp.9 + usp.10 + usp.11 + usp.12 + usp.13 + usp.14 + usp.15 + usp.16 + usp.17 + usp.18 + usp.19 + usp.20 + usp.21 + usp.22 + usp.23 + usp.24 + usp.25 + usp.26 + usp.27 + usp.28 + usp.29 + usp.30 + usp.31)/31)' N=N+1 endwhile *************** V COMP. ******************************************** N=1 while(N<=31) 'set z 'N 'd ((vsp.1 + vsp.2 + vsp.3 + vsp.4 + vsp.5 + vsp.6 + vsp.7 + vsp.8 + vsp.9 + vsp.10 + vsp.11 + vsp.12 + vsp.13 + vsp.14 + vsp.15 + vsp.16 + vsp.17 + vsp.18 + vsp.19 + vsp.20 + vsp.21 + vsp.22 + vsp.23 + vsp.24 + vsp.25 + vsp.26 + vsp.27 + vsp.28 + vsp.29 + vsp.30 + vsp.31)/31)' N=N+1 endwhile *************** UMIDADE ESPECIFICA ********************************* N=1 while(N<=31) 'set z 'N 'd ((qsl.1 + qsl.2 + qsl.3 + qsl.4 + qsl.5 + qsl.6 + qsl.7 + qsl.8 + qsl.9 + qsl.10 + qsl.11 + qsl.12 + qsl.13 + qsl.14 + qsl.15 + qsl.16 + qsl.17 + qsl.18 + qsl.19 + qsl.20 + qsl.21 + qsl.22 + qsl.23 + qsl.24 + qsl.25 + qsl.26 + qsl.27 + qsl.28 + qsl.29 + qsl.30 + qsl.31)/31)' N=N+1 endwhile *************** ALTURA GEOPOTENCIAL ******************************** N=1 while(N<=31) 'set z 'N 'd ((hgt.1 + hgt.2 + hgt.3 + hgt.4 + hgt.5 + hgt.6 + hgt.7 + hgt.8 + hgt.9 + hgt.10 + hgt.11 + hgt.12 + hgt.13 + hgt.14 + hgt.15 + hgt.16 + hgt.17 + hgt.18 + hgt.19 + hgt.20 + hgt.21 + hgt.22 + hgt.23 + hgt.24 + hgt.25 + hgt.26 + hgt.27 + hgt.28 + hgt.29 + hgt.30 + hgt.31)/31)' N=N+1 endwhile ****************** VARIAVEIS SFC *********************************** *************** PLM *********************************************** 'd ((plm.1 + plm.2 + plm.3 + plm.4 + plm.5 + plm.6 + plm.7 + plm.8 + plm.9 + plm.10 + plm.11 + plm.12 + plm.13 + plm.14 + plm.15 + plm.16 + plm.17 + plm.18 + plm.19 + plm.20 + plm.21 + plm.22 + plm.23 + plm.24 + plm.25 + plm.26 + plm.27 + plm.28 + plm.29 + plm.30 + plm.31)/31)' *************** PNMM *********************************************** 'd ((pslp.1 + pslp.2 + pslp.3 + pslp.4 + pslp.5 + pslp.6 + pslp.7 + pslp.8 + pslp.9 + pslp.10 + pslp.11 + pslp.12 + pslp.13 + pslp.14 + pslp.15 + pslp.16 + pslp.17 + pslp.18 + pslp.19 + pslp.20 + pslp.21 + pslp.22 + pslp.23 + pslp.24 + pslp.25 + pslp.26 + pslp.27 + pslp.28 + pslp.29 + pslp.30 + pslp.31)/31)' *************** TP2M *********************************************** 'd ((tshltr2.1 + tshltr2.2 + tshltr2.3 + tshltr2.4 + tshltr2.5 + tshltr2.6 + tshltr2.7 + tshltr2.8 + tshltr2.9 + tshltr2.10 + tshltr2.11 + tshltr2.12 + tshltr2.13 + tshltr2.14 + tshltr2.15 + tshltr2.16 + tshltr2.17 + tshltr2.18 + tshltr2.19 + tshltr2.20 + tshltr2.21 + tshltr2.22 + tshltr2.23 + tshltr2.24 + tshltr2.25 + tshltr2.26 + tshltr2.27 + tshltr2.28 + tshltr2.29 + tshltr2.30 + tshltr2.31)/31)' *************** PRECIPITACAO *************************************** **TOTAL** 'd ((acprec.1 + acprec.2 + acprec.3 + acprec.4 + acprec.5 + acprec.6 + acprec.7 + acprec.8 + acprec.9 + acprec.10 + acprec.11 + acprec.12 + acprec.13 + acprec.14 + acprec.15 + acprec.16 + acprec.17 + acprec.18 + acprec.19 + acprec.20 + acprec.21 + acprec.22 + acprec.23 + acprec.24 + acprec.25 + acprec.26 + acprec.27 + acprec.28 + acprec.29 + acprec.30 + acprec.31)/31)' **CONVECTIVA** 'd ((cuprec.1 + cuprec.2 + cuprec.3 + cuprec.4 + cuprec.5 + cuprec.6 + cuprec.7 + cuprec.8 + cuprec.9 + cuprec.10 + cuprec.11 + cuprec.12 + cuprec.13 + cuprec.14 + cuprec.15 + cuprec.16 + cuprec.17 + cuprec.18 + cuprec.19 + cuprec.20 + cuprec.21 + cuprec.22 + cuprec.23 + cuprec.24 + cuprec.25 + cuprec.26 + cuprec.27 + cuprec.28 + cuprec.29 + cuprec.30 + cuprec.31)/31)' **MICROFISICA** 'd ((aprec.1 + aprec.2 + aprec.3 + aprec.4 + aprec.5 + aprec.6 + aprec.7 + aprec.8 + aprec.9 + aprec.10 + aprec.11 + aprec.12 + aprec.13 + aprec.14 + aprec.15 + aprec.16 + aprec.17 + aprec.18 + aprec.19 + aprec.20 + aprec.21 + aprec.22 + aprec.23 + aprec.24 + aprec.25 + aprec.26 + aprec.27 + aprec.28 + aprec.29 + aprec.30 + aprec.31)/31)' 'disable fwrite' rc=write('template.ctl', 'DSET ^Media_'arqout'.bin') rc=write('template.ctl', 'options sequential big_endian ') rc=write('template.ctl', 'UNDEF -9999. ') rc=write('template.ctl', 'TITLE GEF output variables ') rc=write('template.ctl', 'XDEF 1600 LINEAR 0.0 0.225 ') rc=write('template.ctl', 'YDEF 801 LINEAR -90.00 0.225 ') rc=write('template.ctl', 'ZDEF 31 LEVELS 1 2 3 5 7 10 20 30 50 70 100 150 200 250 300 350 400 450 500 550 600 650 700 750 800 850 900 925 950 975 1000 ') rc=write('template.ctl', 'TDEF 1 LINEAR 00Z01Jan2018 1hr ') rc=write('template.ctl', 'VARS 11 ') rc=write('template.ctl', 'tsl 31 99 TEMPERATURE [K] ') rc=write('template.ctl', 'usp 31 99 U COMP. VEL./ZONAL WIND [m/s] ') rc=write('template.ctl', 'vsp 31 99 V COMP. VEL./MERIDIONAL WIND [m/s] ') rc=write('template.ctl', 'qsl 31 99 SPEC. HUMIDITY [kg/kg] ') rc=write('template.ctl', 'hgt 31 99 GEOPOTENTIAL HEIGHT [gpm] ') rc=write('template.ctl', 'plm 0 99 SURFACE PRESSURE [hPa] ') rc=write('template.ctl', 'pslp 0 99 SEA LEVEL PRESSURE [hPa] ') rc=write('template.ctl', 'tshltr2 0 99 2m TEMPERATURE [K] ') rc=write('template.ctl', 'acprec 0 99 ACCUMULATED TOTAL PRECIPITATION [m] ') rc=write('template.ctl', 'cuprec 0 99 ACCUMULATED CONVECTIVE PRECIPITATION [m] ') rc=write('template.ctl', 'aprec 0 99 ACCUMULATED GRID-SCALE PRECIPITATION [m] ') rc=write('template.ctl', 'ENDVARS ') '!mv template.ctl 'dirout'/Media_'arqout'.ctl' 'quit'