Getting Started
This guide will help you get started with canyonbpy and understand its basic functionality.
Basic Concepts
The canyonbpy name comes from CANYON-B (CArbonate system and Nutrients concentration from hYdrological properties and Oxygen using Neural networks) matlab impplementation. It is a method for estimating various ocean parameters using neural networks.
Your First Prediction
Here's a simple example of how to use canyonbpy with its main function canyonb:
import numpy as np
from datetime import datetime
from canyonbpy import canyonb
# Prepare your data
data = {
'gtime': [datetime(2024, 1, 1)],
'lat': np.array([45.0]),
'lon': np.array([-20.0]),
'pres': np.array([100.0]),
'temp': np.array([15.0]),
'psal': np.array([35.0]),
'doxy': np.array([250.0])
}
# Get predictions
results = canyonb(**data)
# Access specific parameters
ph = results['pH']
ph_uncertainty = results['pH_ci']
Or using the built-in accessor:
import xarray as xr
import canyonbpy # accessor ds.canyonb is registered here
# ds must contain: time, latitude, longitude, pressure, temperature, salinity, doxy
results = ds.canyonb.predict()
# And access the same specific parameters
ph = results['pH']
ph_uncertainty = results['pH_ci']
Understanding the Output
canyonb can predict the following parameters:
AT: Total AlkalinityCT: Total Dissolved Inorganic CarbonpH: pH scalepCO2: Partial pressure of CO2NO3: NitratePO4: PhosphateSiOH4: Silicate
Each parameter comes with uncertainty estimates:
_ci: Total uncertainty_cim: Measurement uncertainty_cin: Neural network uncertainty_cii: Input propagation uncertainty
Next Steps
- Read the User Guide - Input for detailed informations about the inputs provided to
canyonbfunction - Read the User Guide - Advanced Features to deepen your knowledge of the library
- Check out the Examples for more use cases
- See the API Reference for detailed function documentation