Skip to content

Commit

Permalink
v1.0.0 (Lanzamiento inicial)
Browse files Browse the repository at this point in the history
  • Loading branch information
nestor-ld93 committed Aug 26, 2020
1 parent d6c1fc0 commit 21781ad
Show file tree
Hide file tree
Showing 13 changed files with 12,539 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Ignorando archivos de salida:
.directory
.git/
.../
__pycache__/
imgs/
Recursos/
Catalogo_NEIC-Peru-1980-2019.csv
coordenadas_perfiles.txt
linea_perfil.txt
linea_topo_bati.txt
sismos_superficiales.txt
sismos_intermedios.txt
sismos_profundos.txt
sismicidad.eps
sismicidad_perfil.eps
perfil_sismicidad_norte.eps
perfil_sismicidad_centro.eps
perfil_sismicidad_sur.eps
489 changes: 489 additions & 0 deletions 1_sismicidad.csh

Large diffs are not rendered by default.

109 changes: 109 additions & 0 deletions 2_coordenadas_perfil.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#!/bin/sh

#==================================================================================
echo ""
echo "+==========================================================================+"
echo "| COORDENADAS-PERFILES v1.0.0 |"
echo "+==========================================================================+"
echo "| -Genera las coordenadas del perfil a partir de 1 punto (lat0,lon0) |"
echo "| -Ultima actualizacion: 16/07/2020 |"
echo "| -Basado en el programa transcord.f de Cesar Jimenez - 16 Apr 2013 |"
echo "+--------------------------------------------------------------------------+"
echo "| -Copyright (C) 2020 Nestor Luna Diaz |"
echo "| -Contacto: [email protected] |"
echo "+--------------------------------------------------------------------------+"
echo ""
#==================================================================================

#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program. If not, see <https://www.gnu.org/licenses/>.

#==================================================================================

archivo_salida=coordenadas_perfiles.txt
N=3 # 3 perfiles

rm $archivo_salida
i=1

while [ $i -le $N ]; do
################## Variables a modificar (Perfil Norte) #######################
if [ $i -eq 1 ]; then
lat0=$1 # Latitud inicial.
lon0=$2 # Longitud inicial.

L=$3 # Largo del perfil (km2).
W=$4 # Ancho del perfil (km2).
ang=$5 # Angulo de rotacion (grad).
fi

################## Variables a modificar (Perfil Centro) ######################
if [ $i -eq 2 ]; then
lat0=$6 # Latitud inicial.
lon0=$7 # Longitud inicial.

L=$8 # Largo del perfil (km2).
W=$9 # Ancho del perfil (km2).
ang=$10 # Angulo de rotacion (grad).
fi

################## Variables a modificar (Perfil Sur) ########################
if [ $i -eq 3 ]; then
lat0=$11 # Latitud inicial.
lon0=$12 # Longitud inicial.

# L=886.37 # Largo del perfil (km2).
L=$13 # Largo del perfil (km2).
W=$14 # Ancho del perfil (km2).
ang=$15 # Angulo de rotacion (grad).
fi

################## Operaciones para rotar coordenadas ########################
ang=$(echo "scale=6; $ang*3.141592/180.0" | bc -l)

cte1=$(echo "scale=4; $L / 110.0" | bc -l)
xf=$(echo "scale=4; $cte1 * c($ang)" | bc -l)
yf=$(echo "scale=4; $cte1 * s($ang)" | bc -l)
lonf=$(echo "scale=4; $lon0 + $xf" | bc -l)
latf=$(echo "scale=4; $lat0 + $yf" | bc -l)

cte2=$(echo "scale=4; 0.5 * $W / 110.0" | bc -l)
x1=$(echo "scale=4; $lon0 + 0 * c($ang) - $cte2 * s($ang)" | bc -l)
y1=$(echo "scale=4; $lat0 + 0 * s($ang) + $cte2 * c($ang)" | bc -l)
x2=$(echo "scale=4; $lon0 + 0 * c($ang) + $cte2 * s($ang)" | bc -l)
y2=$(echo "scale=4; $lat0 + 0 * s($ang) - $cte2 * c($ang)" | bc -l)
x3=$(echo "scale=4; $lon0 + $cte1 * c($ang) + $cte2 * s($ang)" | bc -l)
y3=$(echo "scale=4; $lat0 + $cte1 * s($ang) - $cte2 * c($ang)" | bc -l)
x4=$(echo "scale=4; $lon0 + $cte1 * c($ang) - $cte2 * s($ang)" | bc -l)
y4=$(echo "scale=4; $lat0 + $cte1 * s($ang) + $cte2 * c($ang)" | bc -l)

W_2=$(echo "scale=1; $W * 0.5" | bc -l) # Se calcula la mitad del ancho.

################## Mostrar y guardar variables en txt ########################
echo ""
echo "-->Extremos del perfil $i:"
echo "P0: $lon0 $lat0"
echo "Pf: $lonf $latf"
echo "-->Extremos del rectangulo $i:"
echo "P1: $x1 $y1"
echo "P2: $x2 $y2"
echo "P3: $x3 $y3"
echo "P4: $x4 $y4"

cat >>$archivo_salida << END
$lon0 $lat0 $lonf $latf $x1 $y1 $x2 $y2 $x3 $y3 $x4 $y4 $W_2
END

i=$((i + 1)) # Contador para el bucle.

done
Loading

0 comments on commit 21781ad

Please sign in to comment.