This guide covers all installation options for OTEX, including optional dependencies and data access configuration.
- Requirements
- Basic Installation
- Optional Dependencies
- Development Installation
- CMEMS Data Access
- Verifying Installation
- Troubleshooting
- Python: 3.9 or higher
- Operating System: Linux, macOS, or Windows
- Memory: 4 GB RAM minimum (8 GB recommended for large analyses)
- Disk Space: 500 MB for installation, additional space for data downloads
Core dependencies (installed automatically):
| Package | Version | Purpose |
|---|---|---|
| numpy | ≥1.20 | Numerical computing |
| pandas | ≥1.3 | Data manipulation |
| scipy | ≥1.7 | Scientific computing |
| matplotlib | ≥3.4 | Visualization |
| xarray | ≥0.19 | N-dimensional arrays |
| netCDF4 | ≥1.5 | NetCDF file support |
| tables | ≥3.6 | HDF5 file support |
| tqdm | ≥4.60 | Progress bars |
pip install otexpip install git+https://github.com/msotocalvo/OTEX.gitCoolProp provides high-accuracy thermodynamic properties for multiple working fluids. Without CoolProp, OTEX uses polynomial correlations for ammonia only.
pip install otex[coolprop]Or install separately:
pip install CoolProp>=6.4Working fluids requiring CoolProp:
- R134a
- R245fa
- Propane
- Isobutane
SALib is required for Sobol sensitivity analysis:
pip install otex[uncertainty]Or install separately:
pip install SALib>=1.4.0Site-screening for protected areas, shipping lanes, and natural hazards requires geospatial libraries:
pip install otex[siting]This installs:
| Package | Purpose |
|---|---|
| geopandas ≥0.12 | Vector geospatial operations (point-in-polygon for WDPA) |
| rasterio ≥1.3 | Raster sampling (vessel density, PGA) |
| shapely ≥2.0 | Geometry buffering |
| pyproj ≥3.4 | Coordinate reference system reprojection |
| requests ≥2.28 | Layer downloads |
The first time a siting layer is needed, OTEX downloads it on demand to
~/.otex/siting_cache/. Total cache size is ~5 GB for the full set
(WDPA + vessel density + PGA + IBTrACS). See the
Siting tutorial for details.
pip install otex[all]This includes:
- CoolProp
- SALib
- geopandas, rasterio, shapely, pyproj, requests (siting)
- pytest and pytest-cov (for testing)
For contributing to OTEX or modifying the source code:
# Clone the repository
git clone https://github.com/msotocalvo/OTEX.git
cd OTEX
# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Linux/macOS
# or: venv\Scripts\activate # Windows
# Install in development mode with all dependencies
pip install -e ".[dev,all]"
# Run tests to verify installation
pytest tests/ -vOTEX supports two oceanographic data sources: CMEMS (Copernicus Marine) and HYCOM (Hybrid Coordinate Ocean Model).
HYCOM data is freely available via OPeNDAP with no account required. This is the easiest way to get started:
from otex.regional import run_regional_analysis
otec_plants, sites = run_regional_analysis(
studied_region='Jamaica',
data_source='HYCOM',
year_start=2020,
year_end=2020,
)Available HYCOM datasets:
| Dataset | Period | Description |
|---|---|---|
| GLBv0.08/expt_53.X | 1994–2015 | Reanalysis |
| GLBy0.08/expt_93.0 | 2019–2024 | Analysis |
Note: HYCOM data is not available for 2016–2018 (gap between experiments). Use CMEMS for those years.
CMEMS provides a longer continuous time series (1993–present) but requires a free Copernicus Marine account.
- Go to Copernicus Marine
- Click "Register" and create an account
- Verify your email address
Option A: Using copernicusmarine CLI (Recommended)
# Install the CLI tool
pip install copernicusmarine
# Login (stores credentials securely)
copernicusmarine loginFollow the prompts to enter your username and password.
Option B: Environment Variables
export COPERNICUSMARINE_SERVICE_USERNAME="your_username"
export COPERNICUSMARINE_SERVICE_PASSWORD="your_password"Add these to your ~/.bashrc or ~/.zshrc for persistence.
Option C: Configuration File
Create ~/.copernicusmarine/credentials with:
username: your_username
password: your_password
from otex.data.cmems import download_data
# If credentials are configured correctly, this won't raise an errorDownloaded data is cached locally in the Data_Results/ directory. Both CMEMS and HYCOM downloads use the same directory structure and CMEMS-compatible file format:
Data_Results/
├── Jamaica/
│ ├── Jamaica_2020_50.0_MW_low_cost/
│ │ ├── T_22.0m_2020_Jamaica.h5 # Warm water temperatures
│ │ ├── T_1062.0m_2020_Jamaica.h5 # Cold water temperatures
│ │ └── OTEC_sites_Jamaica_*.csv # Results
│ └── T_*m_2020_Jamaica_*.nc # Raw NetCDF downloads
├── Philippines/
└── ...
# Test import
import otex
print(f"OTEX version: {otex.__version__}")
# Test configuration
from otex.config import parameters_and_constants
inputs = parameters_and_constants()
print(f"Default cycle: {inputs['cycle_type']}")
print(f"Default fluid: {inputs['fluid_type']}")from otex.core.fluids import get_working_fluid
# This will use CoolProp if available
fluid = get_working_fluid('ammonia', use_coolprop=True)
print(f"Fluid type: {type(fluid).__name__}")If CoolProp is not installed, you'll see a warning and polynomial correlations will be used.
from otex.analysis import MonteCarloAnalysis, UncertaintyConfig
config = UncertaintyConfig(n_samples=10, parallel=False)
mc = MonteCarloAnalysis(T_WW=28.0, T_CW=5.0, config=config)
results = mc.run(show_progress=False)
print(f"LCOE samples: {len(results.lcoe)}")# Run all tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=otex --cov-report=html
# Skip slow tests
pytest tests/ -v -m "not slow"On some systems, CoolProp requires compilation. Try:
# Ubuntu/Debian
sudo apt-get install python3-dev build-essential
# macOS
xcode-select --install
# Then retry
pip install CoolProp# Ubuntu/Debian
sudo apt-get install libhdf5-dev libnetcdf-dev
# macOS
brew install hdf5 netcdf
# Then reinstall
pip install --force-reinstall h5py netCDF4-
Verify credentials:
copernicusmarine login --check
-
Check internet connection and firewall settings
-
Verify data product availability:
copernicusmarine describe --contains GLOBAL_MULTIYEAR_PHY
-
Alternative: Try HYCOM instead (no credentials needed):
run_regional_analysis(studied_region='Jamaica', data_source='HYCOM', year_start=2020, year_end=2020)
- HYCOM OPeNDAP servers may be temporarily unavailable — retry after a few minutes
- Verify the year falls within available ranges (1994–2015 or 2019–2024)
- Check internet connection (HYCOM uses port 443 via HTTPS)
For large analyses, increase available memory or reduce sample size:
config = UncertaintyConfig(n_samples=500) # Reduce from 1000- GitHub Issues: Report bugs or request features
- Discussions: Ask questions