Installation#
pygeostat is compatible with Python 3.10 or newer and follows modern Python packaging standards.
Important
Minimum Python version: Python 3.10
For historical releases supporting older Python versions, see pygeostat v1.1.1.
Requirements#
Before installing pygeostat, ensure that you have:
Python 3.10+
pip(or a compatible Python package installer)
Generic Python installation instructions are intentionally omitted here. If you need help installing Python, see the official Python documentation.
Quick install (recommended)#
pygeostat is published on the Python Package Index (PyPI).
Install it with:
pip install pygeostat
This installs the core library and all required Python dependencies.
Virtual environments (recommended)#
Using a virtual environment is strongly recommended to isolate dependencies.
Using venv (standard Python)#
python -m venv pygeostat-env
source pygeostat-env/bin/activate # Linux / macOS
# pygeostat-env\Scripts\activate # Windows
pip install pygeostat
Using conda (alternative)#
Create the environment
conda create -n <environment_name> python=3.10
Activate the environment
conda activate <environment_name>
Install pygeostat in the activated environment
pip install pygeostat
Additional Software (CCG Members)#
CCG members have the option to install CCG/GSLIB software (executable files) to enable pygeostat scripting features. This can be done using the following function. While GSLIB executable files are available through a public repository, for CCG software a valid access token is required to download executables files from a private repository. The access token is available for CCG members at CCG knowledge base website.
- pygeostat.utility.get_executable(source='gslib', access_token=None, clean=False)[source]
Gets a collection of executable files from a protected repository using an access token. Note that in order to use this function, git needs to be installed on the target computer.
- Parameters:
source (str) – gslib or CCG as the source of software.
access_token (str) – An access token to authorize access to the target private repository for CCG software. Access token is available for CCG members and can be found at CCG knowledge base.
clean (bool) – Option to clean the executable directory prior to upload the files from the target private repository. Note that choosing this option will delete the existing executable files.
Examples
Installing GSLIB executable files
import pygeostat as gs gs.get_executable(source='GSLIB')
Installing CCG software
import pygeostat as gs gs.get_executable(source='CCG', clean=True)
Using the installed software
# Load example data included in pygeostat data_file = gs.ExampleData('cluster') # Initialize the Program object nscore = gs.Program('nscore', getpar=True) # Run normal score transformation parstr = """ Parameters for NSCORE ********************* START OF PARAMETERS: {datafile} - file with data 3 1 2 3 - number of variables and columns 5 - column for weight, 0 if none 0 - column for category, 0 if none 0 - number of records if known, 0 if unknown -1.0e21 1.0e21 - trimming limits 0 -transform using a reference distribution, 1=yes ../histsmth/histsmth.out -file with reference distribution. 1 2 0 - columns for variable, weight, and category 101 -maximum number of quantiles, 0 for all {outfl} -file for output {trnfl} -file for output transformation table """ pars = dict(datafile=data_file.flname, outfl = 'nscore.out', trnfl = 'nscore.trn') nscore.run(parstr=parstr.format(**pars), liveoutput=True)