diff --git a/inputs/Extrair_coords_time-lat-lon.gs b/inputs/Extrair_coords_time-lat-lon.gs new file mode 100644 index 0000000..55c6f73 --- /dev/null +++ b/inputs/Extrair_coords_time-lat-lon.gs @@ -0,0 +1,171 @@ +* ============================================================================ +* Autor do código: +* ____ ___ _ _ _ _ ____ +* | _ \ / _ \| \ | | / \ | | | _ \ +* | |_) | | | | \| | / _ \ | | | | | | +* | _ <| |_| | |\ |/ ___ \| |___| |_| | +* |_| \_\\___/|_| \_/_/ \_\_____|____/ +* +* >>> R O N A L D G U I U S E P P I R A M Í R E Z N I N A <<< +* Ph.D. Candidate in Atmospheric Sciences +* +* Disciplina: Meteorologia Sinótica III +* +* Professores: +* - Prof. Dr. Pedro Leite da Silva Dias +* - Prof. Dr. Ricardo Hallak +* +* Universidade de São Paulo (USP) +* Instituto de Astronomia, Geofísica e Ciências Atmosféricas (IAG-USP) +* Departamento de Ciências Atmosféricas +* +* ============================================================================ +* EXTRAI CENTRO DO CICLONE +* ============================================================================ +* Reiniciar o terminal se existir algum processo passado +* Configurar a tela de cor branca +'reinit' +'set display color white' +'c' + +* ============================================================================ +* Abrir arquivo +* ============================================================================ +'sdfopen mslp_ciclone_dec_2025.nc' + +* ============================================================================ +* Loop no tempo (n) - ALTERAR O N DE ACORDO COM SEU NUMERO DE TEMPOS DE ANALISES +* ============================================================================ +nt=72 +n=1 + +* ============================================================================ +* Área de busca do ciclone +* Ajuste conforme necessário +* ============================================================================ +lat1 = -45 +lat2 = -10 +lon1 = -65 +lon2 = -25 +* ============================================================================ +* Arquivo de saída +* ============================================================================ +outfile = 'track_ciclone_2025.txt' +rc = write(outfile, 'time;Lat;Lon') +* ============================================================================ +* Loop Temporal +* ============================================================================ +while(n<=nt) +'set t 'n +'c' +lati = 0 +long = 0 +latitude = 0 +longitude = 0 +* ============================================================================ +* Definir o domínio de visualização +* ============================================================================ +'set lat ' lat1 ' ' lat2 +'set lon ' lon1 ' ' lon2 +'set mpdset hires brmap' + +* Obter a data +'q time' + data=subwrd(result,3) + +* ========================================== +* Transformar o formato do tempo +* ========================================== +tstr = subwrd(result,3) +* ============================================================================ +* Extrair componentes +* Exemplo: 09Z05DEC2025 +* ============================================================================ +hh = substr(tstr,1,2) +dd = substr(tstr,4,2) +mon = substr(tstr,6,3) +yyyy = substr(tstr,9,4) +* ============================================================================ +* Converter mês para número +* ============================================================================ +if (mon = 'JAN'); mm = '01'; endif +if (mon = 'FEB'); mm = '02'; endif +if (mon = 'MAR'); mm = '03'; endif +if (mon = 'APR'); mm = '04'; endif +if (mon = 'MAY'); mm = '05'; endif +if (mon = 'JUN'); mm = '06'; endif +if (mon = 'JUL'); mm = '07'; endif +if (mon = 'AUG'); mm = '08'; endif +if (mon = 'SEP'); mm = '09'; endif +if (mon = 'OCT'); mm = '10'; endif +if (mon = 'NOV'); mm = '11'; endif +if (mon = 'DEC'); mm = '12'; endif +* ============================================================================ +* Montar formato final +* YYYY-MM-DD-HHmm +* ============================================================================ +data_fmt = yyyy '-' mm '-' dd '-' hh '00' +* ============================================ +* Fazer um plot do campo de pressão reduzida ao nível do mar +'set gxout contour' +'set cint 2' +'d msl/100' +'draw title PRNMM 'data +say '' +say 'SELECT THE CICLONE CENTER' +'q pos' +x=subwrd(result,3) +y=subwrd(result,4) +'q xy2w 'x' 'y +long=subwrd(result,3) +lati=subwrd(result,6) +* ============================================================================ +* Valor mínimo da pressão na área +* ============================================================================ +'d amin(msl,lon=-65,lon=-25,lat=-45,lat=-10)' +pmin=subwrd(result,4)/100 + +* ============================================================================ +* Longitude do mínimo +* ============================================================================ +'d aminlocx(msl,lon=-65,lon=-25,lat=-45,lat=-10)' +xlon=subwrd(result,4) +*say xlon +'set x 'xlon +longitude=subwrd(result,4) + +* ============================================================================ +* Latitude do mínimo +* ============================================================================ +'d aminlocy(msl,lon=-65,lon=-25,lat=-45,lat=-10)' +ylat=subwrd(result,4) +*say ylat +'set y 'ylat +latitude=subwrd(result,4) + +* ============================================================================ +* Extrair em txt +* MOSTRA NO PROMPT DO GRADS AS COORDENADAS OBTIDAS COM O QPOS E +* AS OBTIDAS COM A FUNCAO AMIN - ONDE OCORRE A PRESSAO MINIMA +* MAS GRAVA SOMENTE AS COORDENADAS OBTIDAS COM O QPOS +* AO TERMINAR, ABRA O ARQUIVO CoordCentro.txt PARA VERIFICAR SE SALVOU CORRETAMENTE +* ============================================================================ +* Imprimir na tela as coordenadas geográficas +* ============================================================================ +say 'centro com q pos: ' lati ' ' long +say 'centro com min p: ' latitude ' ' longitude ' ' pmin ' ' n + +* ============================================================================ +* Salvar o arquivo .txt com a informação para o track +* ============================================================================ +linha = data_fmt ';' lati ';' long +rc = write(outfile, linha) +n=n+1 +endwhile +* fim do loop no tempo +rc = close(outfile) + +say ' ' +say 'Processamento finalizado.' +say 'Saida salva em: ' outfile + diff --git a/inputs/Extrair_coords_time-lat-lon_ciclone-automatico.gs b/inputs/Extrair_coords_time-lat-lon_ciclone-automatico.gs new file mode 100644 index 0000000..f66c2b0 --- /dev/null +++ b/inputs/Extrair_coords_time-lat-lon_ciclone-automatico.gs @@ -0,0 +1,161 @@ +* ============================================================================ +* Autor do código: +* ____ ___ _ _ _ _ ____ +* | _ \ / _ \| \ | | / \ | | | _ \ +* | |_) | | | | \| | / _ \ | | | | | | +* | _ <| |_| | |\ |/ ___ \| |___| |_| | +* |_| \_\\___/|_| \_/_/ \_\_____|____/ +* +* >>> R O N A L D G U I U S E P P I R A M Í R E Z N I N A <<< +* Ph.D. Candidate in Atmospheric Sciences +* +* Disciplina: Meteorologia Sinótica III +* +* Professores: +* - Prof. Dr. Pedro Leite da Silva Dias +* - Prof. Dr. Ricardo Hallak +* +* Universidade de São Paulo (USP) +* Instituto de Astronomia, Geofísica e Ciências Atmosféricas (IAG-USP) +* Departamento de Ciências Atmosféricas +* +* ============================================================================ +* EXTRAI CENTRO DO CICLONE +* ============================================================================ +* Reiniciar o terminal se existir algum processo passado +* Configurar a tela de cor branca +'reinit' +'set display color white' +'c' + +* ============================================================================ +* Abre o arquivo +* ============================================================================ +'sdfopen mslp_ciclone_dec_2025.nc' + +* ============================================================================ +* Loop no tempo (n) - ALTERAR O N DE ACORDO COM SEU NUMERO DE TEMPOS DE ANALISES +* ============================================================================ +nt = 72 +n = 1 + +* ============================================================================ +* Área de busca do ciclone +* Ajuste conforme necessário +* ============================================================================ +lat1 = -45 +lat2 = -10 +lon1 = -65 +lon2 = -25 +* ============================================================================ +* Arquivo de saída +* ============================================================================ +outfile = 'track_ciclone_2025_automatico.txt' +*rc = write(outfile, 'data latitude longitude pmin_hPa') +rc = write(outfile, 'time;Lat;Lon') + +* ============================================================================ +* Loop temporal +* ============================================================================ +while (n <= nt) + +'set t ' n +'c' + +* ============================================================================ +* Definir o domínio de visualização +* ============================================================================ +'set lat ' lat1 ' ' lat2 +'set lon ' lon1 ' ' lon2 +*'set mpdset hires' +'set mpdset hires brmap' + +* Obter a data +'q time' + data = subwrd(result,3) + +* ========================================== +* Transformar o formato do tempo +* ========================================== +tstr = subwrd(result,3) +* ============================================================================ +* Extrair componentes +* Exemplo: 09Z05DEC2025 +* ============================================================================ +hh = substr(tstr,1,2) +dd = substr(tstr,4,2) +mon = substr(tstr,6,3) +yyyy = substr(tstr,9,4) +* ============================================================================ +* Converter mês para número +* ============================================================================ +if (mon = 'JAN'); mm = '01'; endif +if (mon = 'FEB'); mm = '02'; endif +if (mon = 'MAR'); mm = '03'; endif +if (mon = 'APR'); mm = '04'; endif +if (mon = 'MAY'); mm = '05'; endif +if (mon = 'JUN'); mm = '06'; endif +if (mon = 'JUL'); mm = '07'; endif +if (mon = 'AUG'); mm = '08'; endif +if (mon = 'SEP'); mm = '09'; endif +if (mon = 'OCT'); mm = '10'; endif +if (mon = 'NOV'); mm = '11'; endif +if (mon = 'DEC'); mm = '12'; endif +* ============================================================================ +* Montar formato final +* YYYY-MM-DD-HHmm +* ============================================================================ +data_fmt = yyyy '-' mm '-' dd '-' hh '00' +* ============================================ + +* Fazer um plot do campo de pressão reduzida ao nível do mar +'set gxout contour' +'set cint 2' +'d msl/100' +'draw title PRNMM ' data + +* ============================================================================ +* Valor mínimo da pressão na área +* ============================================================================ +'d amin(msl,lon='lon1',lon='lon2',lat='lat1',lat='lat2')' +pmin = subwrd(result,4)/100. + +* ============================================================================ +* Longitude do mínimo +* ============================================================================ +'d aminlocx(msl,lon='lon1',lon='lon2',lat='lat1',lat='lat2')' +xlon = subwrd(result,4) +'set x ' xlon +longitude = subwrd(result,4) + +* ============================================================================ +* Latitude do mínimo +* ============================================================================ +'d aminlocy(msl,lon='lon1',lon='lon2',lat='lat1',lat='lat2')' +ylat = subwrd(result,4) +'set y ' ylat +latitude = subwrd(result,4) + +* ============================================================================ +* Imprimir na tela as coordenadas geográficas +* ============================================================================ +say '----------------------------------------' +say 'Tempo: ' data +say 'Centro minimo: lat=' latitude ' lon=' longitude ' p=' pmin ' hPa' + +* ============================================================================ +* Salvar o arquivo .txt com a informação para o track +* ============================================================================ +*linha = data ' ' latitude ' ' longitude ' ' pmin +linha = data_fmt ';' latitude ';' longitude +rc = write(outfile, linha) + +n = n + 1 + +endwhile + +rc = close(outfile) + +say ' ' +say 'Processamento finalizado.' +say 'Saida salva em: ' outfile diff --git a/inputs/cbarn.gs b/inputs/cbarn.gs new file mode 100644 index 0000000..d73f9da --- /dev/null +++ b/inputs/cbarn.gs @@ -0,0 +1,218 @@ +* +* Script to plot a colorbar +* +* The script will assume a colorbar is wanted even if there is +* not room -- it will plot on the side or the bottom if there is +* room in either place, otherwise it will plot along the bottom and +* overlay labels there if any. This can be dealt with via +* the 'set parea' command. In version 2 the default parea will +* be changed, but we want to guarantee upward compatibility in +* sub-releases. +* +* +* modifications by mike fiorino 940614 +* +* - the extreme colors are plotted as triangles +* - the colors are boxed in white +* - input arguments in during a run execution: +* +* run cbarn sf vert xmid ymid +* +* sf - scale the whole bar 1.0 = original 0.5 half the size, etc. +* vert - 0 FORCES a horizontal bar = 1 a vertical bar +* xmid - the x position on the virtual page the center the bar +* ymid - the x position on the virtual page the center the bar +* +* if vert,xmid,ymid are not specified, they are selected +* as in the original algorithm +* + +function colorbar (args) + +sf=subwrd(args,1) +vert=subwrd(args,2) +xmid=subwrd(args,3) +ymid=subwrd(args,4) + +if(sf='');sf=1.0;endif + +* +* Check shading information +* + 'query shades' + shdinfo = result + if (subwrd(shdinfo,1)='None') + say 'Cannot plot color bar: No shading information' + return + endif + +* +* Get plot size info +* + 'query gxinfo' + rec2 = sublin(result,2) + rec3 = sublin(result,3) + rec4 = sublin(result,4) + xsiz = subwrd(rec2,4) + ysiz = subwrd(rec2,6) + ylo = subwrd(rec4,4) + xhi = subwrd(rec3,6) + xd = xsiz - xhi + + ylolim=0.6*sf + xdlim1=1.0*sf + xdlim2=1.5*sf + barsf=0.8*sf + yoffset=0.2*sf + stroff=0.05*sf + strxsiz=0.12*sf + strysiz=0.13*sf +* +* Decide if horizontal or vertical color bar +* and set up constants. +* + if (yloxdlim1) + vchk = 1 + if(vert = 0) ; vchk = 0 ; endif + else + vchk = 0 + if(vert = 1) ; vchk = 1 ; endif + endif +* +* vertical bar +* + + if (vchk = 1 ) + + if(xmid = '') ; xmid = xhi+xd/2 ; endif + xwid = 0.2*sf + ywid = 0.5*sf + + xl = xmid-xwid/2 + xr = xl + xwid + if (ywid*cnum > ysiz*barsf) + ywid = ysiz*barsf/cnum + endif + if(ymid = '') ; ymid = ysiz/2 ; endif + yb = ymid - ywid*cnum/2 + 'set string 1 l 5' + vert = 1 + + else + +* +* horizontal bar +* + + ywid = 0.4 + xwid = 0.8 + + if(ymid = '') ; ymid = ylo/2-ywid/2 ; endif + yt = ymid + yoffset + yb = ymid + if(xmid = '') ; xmid = xsiz/2 ; endif + if (xwid*cnum > xsiz*barsf) + xwid = xsiz*barsf/cnum + endif + xl = xmid - xwid*cnum/2 + 'set string 1 tc 5' + vert = 0 + endif + + +* +* Plot colorbar +* + + + 'set strsiz 'strxsiz' 'strysiz + num = 0 + while (num