Skip to content

Commit 14bcd04

Browse files
authored
Merge pull request #289 from radical-collaboration/global_only
Global_only merged into main
2 parents eeedd2c + d5244b8 commit 14bcd04

File tree

99 files changed

+3371
-1274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+3371
-1274
lines changed

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cff-version: 1.2.0
22
message: "If you use this software, please cite it using the meta-data from 'preferred-citation'."
33
license: MIT
44
title: "Framework for Assessing Changes To Sea-Level (FACTS)"
5-
version: 1.1.0
5+
version: 1.1.2
66
url: "https://github.com/radical-collaboration/facts"
77
authors:
88
- family-names: "Kopp"

FACTS.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ def GenerateTask(tcfg, ecfg, pipe_name, stage_name, task_name, workflow_name="",
9292

9393
if 'climate_data_file' in ecfg['options'].keys():
9494
mvar_dict["CLIMATE_DATA_FILE"]=ecfg['options']['climate_data_file']
95+
96+
if 'climate_gsat_data_file' in ecfg['options'].keys():
9597
mvar_dict["CLIMATE_GSAT_FILE"]=ecfg['options']['climate_gsat_data_file']
98+
99+
if 'climate_ohc_data_file' in ecfg['options'].keys():
96100
mvar_dict["CLIMATE_OHC_FILE"]=ecfg['options']['climate_ohc_data_file']
97101

98102
# Give this task object a name
@@ -303,9 +307,12 @@ def match_options(wopts, eopts):
303307
def ParsePipelineConfig(this_mod, modcfg, global_options={}, relabel_mod=''):
304308

305309
# Load the pipeline configuration file for this module
306-
307310
if not "pipeline_file" in modcfg.keys():
308-
modcfg['pipeline_file'] = "pipeline.yml"
311+
# Checks if there is a global option called 'pipeline_name'
312+
if not 'pipeline_file' in global_options.keys():
313+
modcfg['pipeline_file'] = "pipeline.yml"
314+
if 'pipeline_file' in global_options.keys():
315+
modcfg['pipeline_file'] = global_options['pipeline_file']
309316

310317
if 'module_set' in modcfg.keys():
311318
pcfg_file = os.path.join(os.path.dirname(__file__), "modules",

docker/Dockerfile

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:focal
1+
FROM ubuntu:focal AS facts-core
22

33
# set env variables for RCT and apt
44
ENV DEBIAN_FRONTEND="noninteractive"
@@ -25,18 +25,40 @@ RUN python3 -m venv --system-site-packages factsVe &&\
2525
source factsVe/bin/activate
2626

2727
# installs required FACTS packages
28-
RUN pip install --upgrade \
29-
setuptools pip wheel \
30-
radical.entk \
31-
pyyaml==6.0
28+
RUN pip install --no-cache-dir --upgrade \
29+
setuptools==69.0.2 pip==23.3.1 wheel==0.42.0
3230

31+
RUN pip install --no-cache-dir \
32+
radical.entk==1.42.0 \
33+
pyyaml==6.0.1 \
34+
xarray==2023.1.0 \
35+
numpy==1.24.4 \
36+
netcdf4==1.6.5
37+
3338
# installs R for ubuntu2 0.04 Focal
3439
RUN apt-get update &&\
3540
apt-get install -y --no-install-recommends r-base \
3641
cmake \
3742
libopenblas-dev \
3843
gfortran
3944

45+
46+
ARG NB_USER=jovyan
47+
ARG NB_UID=1000
48+
ENV USER ${NB_USER}
49+
ENV NB_UID ${NB_UID}
50+
ENV HOME /home/${NB_USER}
51+
52+
RUN adduser --disabled-password \
53+
--gecos "Default user" \
54+
--uid ${NB_UID} \
55+
${NB_USER}
56+
57+
# Make sure the contents of our repo are in ${HOME}
58+
USER root
59+
RUN chown -R ${NB_UID} ${HOME}
60+
USER ${NB_USER}
61+
4062
# make directory for radical pilot sandbox
4163
RUN mkdir -p ~/radical.pilot.sandbox
4264

@@ -45,3 +67,17 @@ RUN echo -e ". /factsVe/bin/activate" > ~/.bashrc
4567

4668
# return a shell to the user
4769
CMD /bin/bash
70+
71+
FROM facts-core AS facts-jupyter
72+
73+
USER root
74+
RUN pip install --no-cache-dir \
75+
matplotlib==3.7.4 \
76+
notebook==7.0.6 \
77+
jupyterlab==4.0.9 \
78+
jupyter==1.0.0
79+
80+
EXPOSE 8888
81+
USER ${NB_USER}
82+
83+
#ENTRYPOINT ["jupyter", "lab","--ip=0.0.0.0","--allow-root"]

docker/develop.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33
TAG="facts"
44

55
echo "Build docker container $TAG"
6-
docker build -t "$TAG" .
6+
docker build --target facts-core -t "$TAG" .
7+
8+
TAG="facts-jupyter"
9+
echo "Build docker container $TAG"
10+
docker build --target facts-jupyter -t "$TAG" .

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
author = ''
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = '1.1.1'
25+
release = '1.1.2'
2626

2727

2828
# -- General configuration ---------------------------------------------------

docs/source/configurationfiles.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The **global-options** section of config.yml specifies options that should, by d
1717
* **pyear_step**: step size between projection years
1818
* **pyear_end**: year in which to end projections
1919
* **baseyear**: zero point for sea level projections
20+
* **pipeline_file**: default pipeline file name (optional; defaults to 'pipeline.yml'). See *pipeline_file* under experiment step configuration.
2021

2122
In addition, this section can specify:
2223

@@ -50,7 +51,7 @@ The following third-level entries are used under the module label:
5051

5152
* **stages**: Specifies stages from the pipeline.yml file to be run. Defaults to 'preprocess', 'fit', 'project', 'postprocess'.
5253

53-
* **pipeline_file**: Pipeline file name. Defaults to 'pipeline.yml'. Alternatives can be useful for special cases (e.g., using only Antarctic ice sheet output from a module that produces both Greenland and Antarctic ice sheet output.)
54+
* **pipeline_file**: Pipeline file name. Defaults to 'pipeline.yml'. Alternatives can be useful for special cases (e.g., using only Antarctic ice sheet output from a module that produces both Greenland and Antarctic ice sheet output.) Many modules include a 'pipeline.global.yml' file for running the module without producing localized output.
5455

5556
* **include_in_workflow**: A list of all workflows the module output should be included in at the totaling steps.
5657

docs/source/misc.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,11 @@ it is broken into many files. You may either want to adjust
2727
the pipeline to use the full data file or produce
2828
your own trimmed data file that includes the GESLA sites
2929
of interest to you.
30+
31+
On the Rutgers Amarel system, some modules --
32+
especially emulandice -- exhibit hard-to-trace problems that appear to
33+
be sensitive to the version of Python used. On Amarel, runs have been
34+
successfully completed with Python 3.9.6 and 3.10.12, but not 3.6.8. In
35+
the Docker container, 3.8.10 is know to run successfully. If you are
36+
having hard-to-identify run issues, consider checking the version of Python you are using.
37+

docs/source/quickstart.rst

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,19 @@ Installing and Using FACTS on a GNU/Linux Workstation
2222
two Zenodo entries because of size limitations). (If you have multiple users of FACTS, you might want to put
2323
these ~60 GB of files in a common location and soft-link to each user's directory.)
2424

25+
Rather than installing the data files for all modules, some of which are many gigabytes in size,
26+
you might wish to create a custom version of ``modules-data.urls.txt`` that includes only the data files for modules you intended to use.
27+
For example, if you are only planning on doing global projections with the modules used in the Kopp et al. (2023) manuscript, you
28+
could use the ``modules-data.global-only.urls.txt`` file instead::
29+
30+
wget -P facts/modules-data -i facts/modules-data/modules-data.global-only.urls.txt
31+
2532
3. Create and activate a Python virtual environment, and install FACTS's Python dependences in it. You can use `venv`, `conda` or `virtualenv` to create your Python virtual environment. See `these instructions <https://radicalpilot.readthedocs.io/en/stable/getting_started.html#Installation>`_ for further details. Using `venv`::
2633

2734
python3 -m venv ve3
2835
. ve3/bin/activate
29-
pip install --upgrade setuptools pip wheel radical.entk pyyaml
36+
pip install --upgrade setuptools pip wheel
37+
pip install radical.entk pyyaml
3038

3139
4. Test your install by running the dummy experiment::
3240

@@ -46,13 +54,18 @@ Installing and Using FACTS on a GNU/Linux Workstation
4654

4755
python3 runFACTS.py test
4856

49-
Note that if you are running FACTS using localhost as a resource, all the input files for the experiment (which can be tens of GB) will get copied to ``~/radical.pilot.sandbox``. If you have space limits on your home directory, you may want to make this a symlink to a directory with fewer space limits prior to running FACTS.
5057

51-
Note that the data files for a FACTS experiment and transfered to the compute
58+
Note that all the input files for the experiment (which can be tens of GB if you are doing local sea-level projections that rely upon CMIP output) will get copied to a sandbox
59+
created for each run. If you are running FACTS using localhost as a resource, this sandbox directory is ``~/radical.pilot.sandbox``. If you have space limits on your home directory, you may want to make this a symlink to a directory with fewer space limits prior to running FACTS. The task-level ``.out`` and ``.err`` files in the sandbox are key to debugging module-level code failures; thus, this sandbox is not deleted by default. However, if you wish to save space and do not need these files for debugging, you may wish to save space by deleting the subdirectories of the sandbox folder after each run.
60+
61+
Note that the data files for a FACTS experiment are transfered to the compute
5262
resource with each experiment run. Thus, while it might in principle be possible
5363
to run FACTS on your desktop and use a remote HPC resource, you probably don't
54-
want to do this. At a minimum, you will want to have a fast, high-capacity
55-
network connection to the resource.
64+
want to do this. Most likely, you want to install and run FACTS directly on the remote resource.
65+
At a minimum, you will want to have a fast, high-capacity network connection to the resource.
66+
67+
If you need to run on a HPC resource not previously configured for RADICAL-Pilot (see the `RADICAL-Pilot documentation <https://radicalpilot.readthedocs.io/en/stable/supported.html>`_) ,
68+
the resource will need to be configured. To get assistance with this, create an `issue <https://github.com/radical-cybertools/radical.pilot/issues>`_ on the RADICAL-Pilot repo.
5669

5770
Installing and Using FACTS on a GNU/Linux Container
5871
----------------------------------------------------------------------
@@ -67,6 +80,8 @@ assume FACTS resides outside the container in ``$HOME/facts`` and mounts it with
6780
``/opt/facts``. At the moment, the docker environment appears to work fairly reliably when
6881
using localhost as the resource, but working with remote resources will require additional configuration.
6982

83+
The sandbox directory resides within the container at ``~/radical.pilot.sandbox``. You will likely wish to keep an eye on the size of this directory if you are doing runs that involve large files.
84+
7085
To install FACTS through Docker please follow the steps below:
7186

7287
1. Clone the FACTS repository::
@@ -94,6 +109,9 @@ To install FACTS through Docker please follow the steps below:
94109

95110
modules/emulandice/emulandice_config.sh
96111

112+
The Dockerfile also creates a ``facts-jupyter`` image, should you wish to run FACTS from a Jupyter notebook rather than the commandline. This Docker image can be launched::
113+
114+
docker run -it --volume=$HOME/facts:/opt/facts -w /opt/facts -p 8888:8888 facts-jupyter jupyter lab --ip=0.0.0.0 --port=8888
97115

98116
Testing a module with a shell script
99117
------------------------------------

environment.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: ve3FACTS
2+
channels:
3+
- conda-forge
4+
- defaults
5+
dependencies:
6+
- numpy==1.24.4
7+
- pyyaml==6.0.1
8+
- xarray==2023.1.0
9+
- netcdf4==1.6.5
10+
- matplotlib==3.8.2
11+
- pip==21.2.4
12+
- pip:
13+
- radical.entk==1.42.0

experiments/emulandice.ssp585/config.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@ global-options:
55
pyear_end: 2150
66
pyear_step: 10
77
baseyear: 2005
8+
pipeline_file: "pipeline.global.yml"
89

910
climate_step:
1011
temperature:
1112
module_set: "fair"
1213
module: "temperature"
1314
generates_climate_output: true
14-
# input_data_file:
15-
# - "emissions.csv"
16-
# options:
17-
# rcmip_file: emissions.csv
1815

1916
sealevel_step:
2017

0 commit comments

Comments
 (0)