Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,38 @@ Follow the steps below to run the notebook and plot model results.
## Installation

#### At your local machine
Clone the repository and install fluxy:
Clone the repository and install fluxie:
```
git clone https://github.com/openghg/fluxy.git
cd fluxy
git clone https://github.com/openghg/fluxie.git
cd fluxie
pip install -e .
```

#### At ICOS Jupyter Hub
Create and activate virtual environment:
```
python -m venv fluxy-env
source fluxy-env/bin/activate
python -m venv fluxie-env
source fluxie-env/bin/activate
```
Install IPython kernel package for Jupyter into the current environment and register the current environment as a new kernel:
```
pip install --upgrade pip
pip install ipykernel
python -m ipykernel install --user --name fluxy-env --display-name "fluxy-env"
python -m ipykernel install --user --name fluxie-env --display-name "fluxie-env"
```
And finally install fluxy:
And finally install fluxie:
```
git clone https://github.com/openghg/fluxy.git
cd fluxy
git clone https://github.com/openghg/fluxie.git
cd fluxie
pip install -e .
```

## Quick start

If you want to try fluxy, the easiest way is to run the example notebook `scripts/example_basics.ipynb`.
It will run with some test data and show you what fluxy can do.
If you want to try fluxie, the easiest way is to run the example notebook `scripts/example_basics.ipynb`.
It will run with some test data and show you what fluxie can do.

**Note for ICOS Jupyter Hub:** make sure that your newly created environment (fluxy-env in the example above) is the selected kernel in the drop down list in the upper right corner. If it does not show up, restart your Jupyter instance following these instructions: https://icos-carbon-portal.github.io/jupyter/how_to/#restart-your-jupyter-instance
**Note for ICOS Jupyter Hub:** make sure that your newly created environment (fluxie-env in the example above) is the selected kernel in the drop down list in the upper right corner. If it does not show up, restart your Jupyter instance following these instructions: https://icos-carbon-portal.github.io/jupyter/how_to/#restart-your-jupyter-instance

## Prepare input files
### 1. Flux and concentration netCDF files with model results
Expand Down
2 changes: 1 addition & 1 deletion data/templates/PAR-AVE-EYE_cell_area.cdl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ variables:
cell_area:domain = "EUROPE" ;

// global attributes:
:description = "area per latitude longitude grid cell, used in fluxy to calculate region/country flux annual totals from spatial fluxes" ;
:description = "area per latitude longitude grid cell, used in fluxie to calculate region/country flux annual totals from spatial fluxes" ;
:creator = "Alice Ramsden, Met Office" ;
:creation_date = "2025-07-10" ;
}
6 changes: 3 additions & 3 deletions data/templates/README_templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The most important variables are described below. Please refer to the cdl files
| percentile_flux_total_prior_inversion_grid | mol m-2 s-1 | time, percentile, latitude, longitude | Percentile of prior total `<species>` fluxes on the reduced inversion grid
| percentile_flux_total_posterior_inversion_grid | mol m-2 s-1 | time, percentile, latitude, longitude | Percentile of posterior total `<species>` fluxes on the reduced inversion grid

(1) fluxy accepts any SI unit of the type "amount length-2 time-1" and "mass length-2 time-1". However, please make sure that all grid variables have the same units.
(1) fluxie accepts any SI unit of the type "amount length-2 time-1" and "mass length-2 time-1". However, please make sure that all grid variables have the same units.

| By-country variables | Units (2) | Dimensions | Description |
|:----------------------------------------|:----------|:--------------|:-------------------------------------------------|
Expand All @@ -45,7 +45,7 @@ The most important variables are described below. Please refer to the cdl files
| *Optional*
| covariance_flux_total_posterior_country | kg2 yr-2 | time, country, country | Covariance of country-total posterior `<species>` fluxes

(2) fluxy accepts any SI unit of the type "mass time-1" for country flux variables and "mass2 time-2" for the covariance variable. However, please make sure that all by-country variables have the same units and that the covariance variable has the respective squared units.
(2) fluxie accepts any SI unit of the type "mass time-1" for country flux variables and "mass2 time-2" for the covariance variable. However, please make sure that all by-country variables have the same units and that the covariance variable has the respective squared units.

| Auxiliary variables | Units | Dimensions | Description |
|:--------------------|:-------|:-----------------------------|:-------------------------------------------|
Expand Down Expand Up @@ -94,7 +94,7 @@ The most important variables are described below. Please refer to the cdl files
| stdev_mf_observed_variability | mol mol-1 | index | Variability of observed mole fraction within aggregation interval
| stdev_mf_model | mol mol-1 | index | Model uncertainty of simulated mole fraction

(3) fluxy also accepts ppm, ppb and ppt. However, please make sure that all variables have the same units.
(3) fluxie also accepts ppm, ppb and ppt. However, please make sure that all variables have the same units.

## 3. Eddy covariance flux file

Expand Down
8 changes: 4 additions & 4 deletions data/templates/ec_flux.cdl
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ variables:
:title = "Eddy covariance fluxes from Hardau" ;
:institution = "Empa" ;
:source = "Eddypro V2" ;
:comment = "Data processed with Eddypro V2 for fluxy plots" ;
:comment = "Data processed with Eddypro V2 for fluxie plots" ;
:creation_date = "2025-07-21T16:55:02.806705" ;
:fluxy_substance = "<species>" ;
:fluxy_data_type = "eddy_flux" ;
:fluxy_model = "EDDY_HARDAU" ;
:fluxie_substance = "<species>" ;
:fluxie_data_type = "eddy_flux" ;
:fluxie_model = "EDDY_HARDAU" ;

}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

from config_annex_plot import AnnexConfig

from fluxy.cli.utils_annex_plot import (
from fluxie.cli.utils_annex_plot import (
get_species_specific_settings,
create_str_dataframe,
make_table,
)
from fluxy.io import read_config_files, read_model_output, read_flux_total_fgases
from fluxy.operators.select import slice_flux
from fluxy.config import set_model_colors, set_model_labels
from fluxy.plots.flux_timeseries import plot_country_flux
from fluxy.plots.flux_map import plot_flux_map_over_time
from fluxie.io import read_config_files, read_model_output, read_flux_total_fgases
from fluxie.operators.select import slice_flux
from fluxie.config import set_model_colors, set_model_labels
from fluxie.plots.flux_timeseries import plot_country_flux
from fluxie.plots.flux_map import plot_flux_map_over_time

logger = logging.getLogger(__name__)

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def create_str_dataframe(
The values are string of the form "<mean> \\pm <uncertainty>", made to be usable directly to make the tex output for the annexes tables. Set the units and right number of digits.
NOTE: Assume that the units in res is Tg CO2-eq yr-1
Args:
res: pandas dataframe containing the results. It should be the output (or concatenation of outputs) of `plot_country_flux` from fluxy/plots/flux_timeseries.py
res: pandas dataframe containing the results. It should be the output (or concatenation of outputs) of `plot_country_flux` from fluxie/plots/flux_timeseries.py
The columns of this dataframe are "type", "model", "sector", "country", "species", "time", "mean_val", "min_unc", "max_unc".
inventory_year: inventory year to put in the outputted dataframe (has to b present in <res>).
species: species to put include in the table
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions fluxy/io.py → fluxie/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
import pandas as pd
import xarray as xr

from fluxy import config
from fluxy.operators.flux_align_dataset import align_time
from fluxy.operators.regions import extract_region_flux
from fluxy.operators.select import slice_flux, get_intake_height, get_site_index
from fluxy.types import DataType, DataTypes, file_pattern
from fluxie import config
from fluxie.operators.flux_align_dataset import align_time
from fluxie.operators.regions import extract_region_flux
from fluxie.operators.select import slice_flux, get_intake_height, get_site_index
from fluxie.types import DataType, DataTypes, file_pattern

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -546,7 +546,7 @@ def read_flux_total_fgases(
if all_species is None:
raise ValueError(
f"No list of species was found in the config_data for {species}. "
+ f"If config_data was created with read_config_files from fluxy/io.py, update configs/species_info.json."
+ f"If config_data was created with read_config_files from fluxie/io.py, update configs/species_info.json."
)
if "CO2-eq" not in unit:
raise ValueError("Unit should be in CO2-eq.")
Expand Down Expand Up @@ -661,7 +661,7 @@ def create_flux_total_fgases(ds_all, species, regions, models, only_overlapping)
If True, only includes time periods where all models have data. Otherwise, uses all available data.
Returns:
ds_output (dictionary of datasets):
dictionnary of xarray datasets ready to be used with fluxy plot methods.
dictionnary of xarray datasets ready to be used with fluxie plot methods.
"""
ds_output = {}
for model in models:
Expand Down Expand Up @@ -768,7 +768,7 @@ def edit_vars_and_attributes(
Options for "monthly" and "yearly".
file_type (str):
Output file type.
See :py:class:`fluxy.types.DataType` for options.
See :py:class:`fluxie.types.DataType` for options.
regions_info (dict of str):
Dictionary with country and region names (read from config file).
species (str, optional):
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion fluxy/operators/convert.py → fluxie/operators/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import re
from collections import Counter
from typing import Literal
from fluxy import config
from fluxie import config

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions fluxy/operators/ecflux.py → fluxie/operators/ecflux.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from fluxy.types import DsAll
from fluxy.operators.utils import apply_to_dict_or_single
from fluxie.types import DsAll
from fluxie.operators.utils import apply_to_dict_or_single
import xarray as xr


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import xarray as xr
import logging

from fluxy.operators.flux_align_dataset import align_time
from fluxie.operators.flux_align_dataset import align_time

logger = logging.getLogger(__name__)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import warnings

from typing import List, Tuple, Literal
from fluxy.plots.utils import print_period, get_frequency
from fluxie.plots.utils import print_period, get_frequency


def get_flux_mean(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from matplotlib.cm import get_cmap

from fluxy.operators.regions import extract_region_inventory_flux
from fluxie.operators.regions import extract_region_inventory_flux


def retrieve_inventories(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import numpy as np
import xarray as xr
from pathlib import Path
from fluxy.operators.convert import get_units_conversion_factor
from fluxy.operators.flux_align_dataset import align_lat_lon
from fluxie.operators.convert import get_units_conversion_factor
from fluxie.operators.flux_align_dataset import align_lat_lon

logger = logging.getLogger(__name__)

Expand Down
6 changes: 3 additions & 3 deletions fluxy/operators/mf.py → fluxie/operators/mf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import xarray as xr
import pandas as pd
import logging
from fluxy.operators.convert import get_variables
from fluxie.operators.convert import get_variables
from typing import Literal

from fluxy.operators.stats import stats_observed_vs_simulated
from fluxie.operators.stats import stats_observed_vs_simulated

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -133,7 +133,7 @@ def stats_mf(
Calculates multiple statistical measures of the fit between the posterior
mean mf and the observed mole fraction.

This calls :py:func:`fluxy.operators.stats.stats_observed_vs_simulated`
This calls :py:func:`fluxie.operators.stats.stats_observed_vs_simulated`

Args:
ds_all (dictionary of datasets):
Expand Down
2 changes: 1 addition & 1 deletion fluxy/operators/regions.py → fluxie/operators/regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy as np
import xarray as xr

from fluxy.operators.convert import get_units_conversion_factor
from fluxie.operators.convert import get_units_conversion_factor

logger = logging.getLogger(__name__)

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion fluxy/operators/sectors.py → fluxie/operators/sectors.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import xarray as xr

from fluxy.operators.utils import apply_to_dict_or_single
from fluxie.operators.utils import apply_to_dict_or_single


def sectors_group_from_config_or_dict(
Expand Down
2 changes: 1 addition & 1 deletion fluxy/operators/select.py → fluxie/operators/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pandas as pd
import xarray as xr

from fluxy.operators.convert import scale_variables
from fluxie.operators.convert import scale_variables

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion fluxy/operators/stats.py → fluxie/operators/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np
import pandas as pd
import xarray as xr
from fluxy.operators.select import get_unique_sites, slice_site
from fluxie.operators.select import get_unique_sites, slice_site


def stats_observed_vs_simulated(
Expand Down
2 changes: 1 addition & 1 deletion fluxy/operators/utils.py → fluxie/operators/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import xarray as xr

from fluxy.types import DsAll
from fluxie.types import DsAll


def apply_to_dict_or_single(func):
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions fluxy/plots/correlation.py → fluxie/plots/correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import xarray as xr
import numpy as np

from fluxy import config
from fluxy.operators.select import slice_site
from fluxy.types import VariableType
from fluxie import config
from fluxie.operators.select import slice_site
from fluxie.types import VariableType
import matplotlib.pyplot as plt

logger = logging.getLogger(__name__)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import matplotlib.pyplot as plt

from fluxy.plots.utils import stack_plot
from fluxie.plots.utils import stack_plot

WIND_LABELS = {
4: ["N", "E", "S", "W"],
Expand Down
18 changes: 9 additions & 9 deletions fluxy/plots/flux_map.py → fluxie/plots/flux_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import numpy as np
import logging

from fluxy.operators.flux_align_dataset import align_map_data
from fluxy.operators.flux_combine import combine_map_dataset
from fluxy.operators.flux_map_diff import define_var_plot, make_model_diff_ds
from fluxy.operators.flux_map_resample import resample_over_period
from fluxy.plots.utils import (
from fluxie.operators.flux_align_dataset import align_map_data
from fluxie.operators.flux_combine import combine_map_dataset
from fluxie.operators.flux_map_diff import define_var_plot, make_model_diff_ds
from fluxie.operators.flux_map_resample import resample_over_period
from fluxie.plots.utils import (
Region,
add_colorbar,
add_custom_markers,
Expand Down Expand Up @@ -66,7 +66,7 @@ def plot_flux_map(
config_data (dict of dict):
Dictionary of models and species information (read from json file).
model_labels (list):
List of model_labels from fluxy.config.
List of model_labels from fluxie.config.
cmap (str, optional):
Colour map for flux plots.
cmap_diff (str, optional):
Expand Down Expand Up @@ -330,7 +330,7 @@ def plot_flux_map_model_comparison(
config_data (dict of dict):
Dictionary of models and species information (read from json file).
model_labels (list):
List of model_labels from fluxy.config.
List of model_labels from fluxie.config.
cmap (str, optional):
Colour map for flux plots.
cmap_diff (str, optional):
Expand Down Expand Up @@ -562,7 +562,7 @@ def plot_flux_map_over_time(
config_data (dict of dict):
Dictionary of models and species information (read from json file).
model_labels (list):
List of model_labels from fluxy.config.
List of model_labels from fluxie.config.
chop_by (str or list):
Time units to perform the average, options for 'year', 'month' and 'season'.
Alternatively, a list of starting dates or months number can be provided.
Expand Down Expand Up @@ -1090,7 +1090,7 @@ def plot_flux_map_period_comparison(
config_data (dict of dict):
Dictionary of models and species information (read from json file).
model_labels (list):
List of model_labels from fluxy.config.
List of model_labels from fluxie.config.
chop_by (str or list):
Time units to perform the average, options for 'year', 'month' and 'season'.
Alternatively, a list of starting dates or months number can be provided.
Expand Down
Loading