1. Instalando la GSLIB

GSLIB (Geostatistical Software Library) es una de las primeras colecciones de software geoestadístico del mundo. Fue desarrollada por estudiantes y profesores de la Universidad de Stanford, con Clayton Deutsch y André Journel como autores principales.

Características clave

  • Finalidad: GSLIB se utiliza para una variedad de tareas geoestadísticas, como el análisis de datos, la estimación de variogramas, el kriging y las simulaciones estocásticas en 1D, 2D y 3D.

  • Código original: El código original de la biblioteca está escrito en Fortran, pero sus algoritmos han sido ampliamente utilizados y reimplementados en otros lenguajes.

  • Dominio público: GSLIB es de dominio público y se distribuye con el código fuente y ejecutables para PC.

  • Reimplementación en Python: Los algoritmos de GSLIB se han reimplementado en Python en bibliotecas como GeostatPy, lo que facilita su uso en entornos de programación modernos.

  • Aplicaciones: Es una herramienta fundamental para geólogos, ingenieros de minas y científicos de datos en el análisis de datos espaciales y la estimación de recursos.

1.1. Instalacion en Colab

1.1.1. Descargar Programas

[ ]:
%%bash

url="http://www.statios.com/software/gslib90_ls.tar.gz"
wget -O gslib90_ls.tar.gz $url
tar -xf gslib90_ls.tar.gz
rm gslib90_ls.tar.gz

mkdir Gslib90

gfortran -w -O3 -fallow-argument-mismatch -o ./Gslib90/gamv ./gslib90/gamv.for ./gslib90/gslib/*.for
gfortran -w -O3 -fallow-argument-mismatch -o ./Gslib90/vmodel ./gslib90/vmodel.for ./gslib90/gslib/*.for
gfortran -w -O3 -fallow-argument-mismatch -o ./Gslib90/ik3d ./gslib90/ik3d.for ./gslib90/gslib/*.for
gfortran -w -O3 -fallow-argument-mismatch -o ./Gslib90/kt3d ./gslib90/kt3d.for ./gslib90/gslib/*.for
gfortran -w -O3 -fallow-argument-mismatch -o ./Gslib90/varmap ./gslib90/varmap.for ./gslib90/gslib/*.for

rm -r gslib90
--2025-10-23 14:00:30--  http://www.statios.com/software/gslib90_ls.tar.gz
Resolving www.statios.com (www.statios.com)... 184.106.55.106
Connecting to www.statios.com (www.statios.com)|184.106.55.106|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 291768 (285K) [application/x-gzip]
Saving to: ‘gslib90_ls.tar.gz’

     0K .......... .......... .......... .......... .......... 17%  547K 0s
    50K .......... .......... .......... .......... .......... 35% 1.03M 0s
   100K .......... .......... .......... .......... .......... 52% 10.3M 0s
   150K .......... .......... .......... .......... .......... 70% 1.13M 0s
   200K .......... .......... .......... .......... .......... 87% 11.7M 0s
   250K .......... .......... .......... ....                 100%  340M=0.2s

2025-10-23 14:00:30 (1.46 MB/s) - ‘gslib90_ls.tar.gz’ saved [291768/291768]

1.1.2. Probar correcta instalación

[ ]:
import subprocess

# Using subprocess.run() to capture output
result = subprocess.run(["./Gslib90/gamv.exe", "holar.par"], capture_output=True, text=True, check=True)
print(result.stdout)

 GAMV Version: 3.000

 ERROR - the parameter file does not exist,
         check for the file and try again


1.2. Instalacion en Jupyter (Windows)

1.2.1. Descargar Programas

Puedes descargar directamente de la pagina

http://www.statios.com/software/gslib90.zip

y descomprimir los programas.

Asegúrate de que todos se puedan acceder dentro de la misma carpeta Gslib90.

También puedes usar el siguiente código en Jupyter.

[ ]:
import urllib.request
import zipfile
import os

url = "http://www.statios.com/software/gslib90.zip"
zip_path = "gslib90.zip"

# Descargar el archivo zip
urllib.request.urlretrieve(url, zip_path)

# Descomprimir el zip en el directorio actual
with zipfile.ZipFile(zip_path, "r") as z:
    z.extractall()

# Eliminar el archivo zip descargado
os.remove(zip_path)

1.2.2. Probar correcta instalación

[ ]:
import subprocess

# Using subprocess.run() to capture output
result = subprocess.run(["./Gslib90/gamv", "holar.par"], capture_output=True, text=True, check=True)
print(result.stdout)

GAMV Version: 2.905

ERROR - the parameter file does not exist,
        check for the file and try again

Stop - Program terminated.


1.3. Instalacion en Jupyter (Mac)

1.3.1. Instalar el compilador Fortran

[25]:
!conda install -c conda-forge gfortran -y
The system cannot find the path specified.

1.3.2. Verificar la instalación

[ ]:
!gfortran --version
GNU Fortran (conda-forge gcc 15.1.0-5) 15.1.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

1.3.3. Descargar Programas

[ ]:
import urllib.request
import zipfile
import os

url = "http://www.statios.com/software/gslib90_ls.tar.gz"
tar_path = "gslib90_ls.tar.gz"

# Descargar el archivo tar.gz
urllib.request.urlretrieve(url, tar_path)
# Descomprimir el tar.gz en el directorio actual
import tarfile
with tarfile.open(tar_path, "r:gz") as tar:
    tar.extractall("temp_gslib90")
os.remove(tar_path)

## Crear directorio Gslib90
os.makedirs("Gslib90", exist_ok=True)
C:\Users\Alvaro\AppData\Local\Temp\ipykernel_11476\1739640109.py:13: DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.
  tar.extractall("temp_gslib90")

1.3.4. Compilar programas

[ ]:
!gfortran -w -O3 -fallow-argument-mismatch -o ./Gslib90/gamv ./temp_gslib90/gslib90/gamv.for ./temp_gslib90/gslib90/gslib/*.for
!gfortran -w -O3 -fallow-argument-mismatch -o ./Gslib90/vmodel ./temp_gslib90/gslib90/vmodel.for ./temp_gslib90/gslib90/gslib/*.for
!gfortran -w -O3 -fallow-argument-mismatch -o ./Gslib90/ik3d ./temp_gslib90/gslib90/ik3d.for ./temp_gslib90/gslib90/gslib/*.for
!gfortran -w -O3 -fallow-argument-mismatch -o ./Gslib90/kt3d ./temp_gslib90/gslib90/kt3d.for ./temp_gslib90/gslib90/gslib/*.for
!gfortran -w -O3 -fallow-argument-mismatch -o ./Gslib90/varmap ./temp_gslib90/gslib90/varmap.for ./temp_gslib90/gslib90/gslib/*.for

1.3.5. Remover Carpeta temporal a mano

1.3.6. Probar correcta instalación

[ ]:
import subprocess

# Using subprocess.run() to capture output
result = subprocess.run(["./Gslib90/gamv", "holar.par"], capture_output=True, text=True, check=True)
print(result.stdout)

 GAMV Version: 3.000

 ERROR - the parameter file does not exist,
         check for the file and try again