Skip to content

Commit

Permalink
added a sample script
Browse files Browse the repository at this point in the history
  • Loading branch information
nocollier committed Feb 1, 2023
1 parent 270510e commit 689cccc
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
38 changes: 38 additions & 0 deletions demo/sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""A sample script which uses data from cli137 on OLCF."""
import os

from ILAMB.ModelResult import ModelResult
from ILAMB.Regions import Regions

from ilambk.pre import install_scripts, prepare_cluster

# register ILAMB regions which exlcude oceans and Antarctica
ROOT = os.environ["ILAMB_ROOT"]
ilamb_region = Regions()
ilamb_region.addRegionLatLonBounds(
"noant", "No Antarctica", (-60, 89.999), (-179.999, 179.999), ""
)
ilamb_region.addRegionNetCDF4(f"{ROOT}/DATA/regions/GlobalLand.nc")

# setup models to be used
M = []
M.append(ModelResult(f"{ROOT}/MODELS/CMIP6/CESM2", modelname="CESM2"))
M.append(
ModelResult(
"",
modelname="Reference",
paths=[f"{ROOT}/DATA/pr/GPCPv2.3", f"{ROOT}/DATA/tas/CRU4.02"],
)
)

# setup clustering
prepare_cluster(
"sample",
M,
[{"vars": ["tas", "pr"], "variability": False}],
range(1930, 2011, 10),
regions=["global", "noant"],
)

# copy runtime scripts
install_scripts("sample", "/ccs/home/jbk/bin")
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ dependencies = [
"ilamb","numpy","pandas","plotly","xarray","matplotlib","cartopy","importlib_resources"
]

[tool.setuptools.packages.find]
where = ["ilambk"]

[tool.setuptools.package-data]
ilambk = ["*.sh"]
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ install_requires =
cartopy
importlib_resources

[options.packages.find]
where = ilambk

[options.package_data]
ilambk =
*.sh

0 comments on commit 689cccc

Please sign in to comment.