Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move ci to balfrin #15

Merged
merged 4 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 4 additions & 4 deletions jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pipeline {
PATH = "$WORKSPACE/miniconda/bin:$PATH"
}
agent {
label 'tsa'
label 'balfrin'
}

post {
Expand All @@ -33,13 +33,13 @@ pipeline {
sh '''#!/usr/bin/env bash
set -e
spack_c2sm_url=https://github.com/C2SM/spack-c2sm.git
spack_c2sm_tag=v0.20.1.0
spack_c2sm_tag=v0.20.1.9
spack_c2sm_dir=${WORKSPACE}/s
git clone --depth 1 --recurse-submodules -b ${spack_c2sm_tag} ${spack_c2sm_url} ${spack_c2sm_dir}
. ${spack_c2sm_dir}/setup-env.sh
spack env activate -p ${WORKSPACE}/spack-env
spack mirror add iwf2-mirror /project/s83c/rz+/spack-mirror-test/
spack install --no-check-signature
spack mirror add iwf2-mirror /store_new/mch/msopr/icon_workflow_2/spack-mirror
spack install --no-check-signature --no-checksum
'''
}
}
Expand Down
8 changes: 4 additions & 4 deletions spack-env/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# configuration settings.
spack:
specs:
- fdb
- eckit@1.20.2 ~mpi
- eccodes@2.25 jp2k=none
- hdf5 ~mpi
- fdb@=5.11.116 +tools
- eckit@=1.26.2 ~mpi
- eccodes@=2.33.0 jp2k=none
- metkit@=1.11.9
view: true
concretizer:
unify: true
Expand Down
2 changes: 1 addition & 1 deletion src/meteodatalab/data/fdb_config_balfrin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ schema: /scratch/mch/ckanesan/fdb-setup/fdb-schema
spaces:
- handler: Default
roots:
- path: /scratch/mch/ckanesan/fdb-root/
- path: /scratch/mch/ckanesan/fdb_32_39x45_51/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this fdb root path not also be in /store_new/mch/msopr/icon_workflow_2/?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I just move the files or do I need to archive it again?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just move the directory but not 100% sure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be working

4 changes: 2 additions & 2 deletions src/meteodatalab/mars.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ def to_fdb(self) -> dict[str, typing.Any]:

obj = dc.replace(self, levelist=levelist)
out = typing.cast(dict[str, typing.Any], obj.dump())
return out | {"param": self._param_id()}
return out | {"param": self._param_id(), "model": out["model"].lower()}

def to_polytope(self) -> dict[str, typing.Any]:
result = self.to_fdb()
if isinstance(result["param"], list):
param: str | list[str] = [str(p) for p in result["param"]]
else:
param = str(result["param"])
return result | {"param": param, "model": result["model"].lower()}
return result | {"param": param}
11 changes: 8 additions & 3 deletions tests/test_meteodatalab/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ def machine():
@pytest.fixture
def data_dir(request, machine):
"""Base data dir."""
if machine != "tsa":
if machine == "tsa":
base_dir = Path("/project/s83c/rz+/icon_data_processing_incubator/")
elif machine == "balfrin":
base_dir = Path("/scratch/mch/ckanesan/")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this path, could it not also be in /store_new/mch/msopr/icon_workflow_2/?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it could but I mentioned during the meeting that I'm trying to figure out a sensible way to reduce the amount of data before moving it. However, I can see that there's a full COSMO-1E run in that folder already. Is there a documented policy regarding storage at CSCS?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I am aware of. But I find a project folder is more suitable than one of our scratches, then we can all manage/develop the tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, the testdata would be small enough to be hosted on nexus but that's probably for the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://confluence.cscs.ch/pages/viewpage.action?pageId=785285325
This was published for store but I don't know if it's also valid for store_new. If it is, the dataset is problematic due to the 50k files per TB rule. I might need to tar it.

else:
return None
base_dir = Path("/project/s83c/rz+/icon_data_processing_incubator/")
marker = request.node.get_closest_marker("data")
if marker is None:
return base_dir / "datasets/32_39x45_51"
Expand All @@ -45,6 +48,8 @@ def data_dir(request, machine):
return base_dir / "datasets/32_39x45_51/COSMO-1E_time"
case "reduced-ens":
return base_dir / "datasets/32_39x45_51/COSMO-1E_ens"
case "flexpart":
return base_dir / "data/flexpart"
raise RuntimeError(f"No match for data mark {marker.args[0]}")


Expand All @@ -59,7 +64,7 @@ def fieldextra_path(machine):
"""Fieldextra path."""
conf = {
"tsa": Path("/project/s83c/fieldextra/tsa"),
"balfrin": Path("/users/tsm/proj.aare/fieldextra/v14.3.1/"),
"balfrin": Path("/users/tsm/proj.aare/fieldextra/v14.4.0/"),
}
return conf.get(machine)

Expand Down
7 changes: 4 additions & 3 deletions tests/test_meteodatalab/test_brn.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@

# First-party
import meteodatalab.operators.brn as mbrn
from meteodatalab.grib_decoder import GribReader
from meteodatalab.data_source import DataSource
from meteodatalab.grib_decoder import load
from meteodatalab.metadata import set_origin_xy


def test_brn(data_dir, fieldextra):
datafile = data_dir / "COSMO-1E/1h/ml_sl/000/lfff00000000"
cdatafile = data_dir / "COSMO-1E/1h/const/000/lfff00000000c"

reader = GribReader.from_files([cdatafile, datafile])
ds = reader.load_fieldnames(["P", "T", "QV", "U", "V", "HHL", "HSURF"])
source = DataSource(datafiles=[datafile, cdatafile])
ds = load(source, {"param": ["P", "T", "QV", "U", "V", "HHL", "HSURF"]})
set_origin_xy(ds, "HHL")

brn = mbrn.fbrn(
Expand Down
9 changes: 1 addition & 8 deletions tests/test_meteodatalab/test_flexpart.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Standard library
from pathlib import Path

# Third-party
import pytest
import xarray as xr
Expand All @@ -12,12 +9,8 @@
from meteodatalab.grib_decoder import GribReader


@pytest.fixture
def data_dir(data_dir):
return Path("/project/s83c/rz+/icon_data_processing_incubator/data/flexpart/")


@pytest.mark.ifs
@pytest.mark.data("flexpart")
def test_flexpart(data_dir, fieldextra):
datafiles = list(data_dir.glob("efs*"))
constants = ("z", "lsm", "sdor")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_meteodatalab/test_mars.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def sample():
"expver": "0001",
"levtype": "ml",
"levelist": list(range(1, 81)),
"model": "COSMO-1E",
"model": "cosmo-1e",
"number": 0,
"stream": "enfo",
"param": 500028, # U
Expand Down Expand Up @@ -46,7 +46,7 @@ def test_fdb_c2e(sample):
step=0,
model=mars.Model.COSMO_2E,
).to_fdb()
expected = sample | {"model": "COSMO-2E", "levelist": list(range(1, 61))}
expected = sample | {"model": "cosmo-2e", "levelist": list(range(1, 61))}

assert observed == expected

Expand Down
Loading