-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3b8083
commit 7e7bdc3
Showing
5 changed files
with
97,639 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import argparse | ||
|
||
import yaml | ||
|
||
|
||
def build_cc_db(paths): | ||
""" | ||
Build a cosima-cookbook database for a list of paths | ||
""" | ||
import cosima_cookbook as cc | ||
|
||
db = "./out/cookbook.db" | ||
session = cc.database.create_session(db) | ||
cc.database.build_index(paths, session, force=False) | ||
|
||
|
||
def build_nri_cat(paths): | ||
""" | ||
Build an access-nri-intake catalog for a list of paths | ||
""" | ||
from access_nri_intake.catalog.manager import CatalogManager | ||
from access_nri_intake.source.builders import AccessOm2Builder | ||
|
||
catalog = CatalogManager("./out/catalog.csv") | ||
|
||
for path in paths: | ||
name = path.split("/")[-1] | ||
catalog.build_esm( | ||
name=name, | ||
description=name, | ||
builder=AccessOm2Builder, | ||
path=path, | ||
metadata={"model": ["ACCESS-OM2"]}, | ||
directory="./out/catalog_source/", | ||
overwrite=True, | ||
).add() | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser( | ||
description="Build a test catalog/database for benchmarking." | ||
) | ||
parser.add_argument( | ||
"--database", | ||
choices=["nri", "cc"], | ||
required=True, | ||
help="Whether to build an access-nri-intake catalog ('nri') or a cosima-cookbook database ('cc').", | ||
) | ||
|
||
with open("./config/access-om2.yaml") as fobj: | ||
config = yaml.safe_load(fobj) | ||
|
||
paths = [source["path"][0] for source in config["sources"]] | ||
|
||
args = parser.parse_args() | ||
database = args.database | ||
|
||
if database == "nri": | ||
build_nri_cat(paths) | ||
elif database == "cc": | ||
build_cc_db(paths) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash -l | ||
|
||
#PBS -P tm70 | ||
#PBS -l storage=gdata/tm70+gdata/ik11+gdata/cj50+gdata/hh5 | ||
#PBS -q normal | ||
#PBS -l walltime=48:00:00 | ||
#PBS -l mem=192gb | ||
#PBS -l ncpus=48 | ||
#PBS -l wd | ||
#PBS -j oe | ||
|
||
module use /g/data/hh5/public/modules | ||
module load conda/analysis3-unstable | ||
|
||
python benchmark.py --database="cc" |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.