Skip to content

Commit

Permalink
Add meson and ninja to environment
Browse files Browse the repository at this point in the history
  • Loading branch information
tbody-cfs committed Jul 18, 2024
1 parent 0eed365 commit 24f40e2
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 13 deletions.
44 changes: 43 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ pyyaml = ">=6.0"
xarray = ">=2023"
pint-xarray = ">=0.3"
click = ">=8.1"
meson = "^1.5.0"
ninja = "^1.11.1.1"

[tool.poetry.group.dev.dependencies]
# Install pytest into all development environments
Expand Down
2 changes: 1 addition & 1 deletion radas/adas_interface/prepare_adas_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def build_adas_file_reader(
urllib.request.urlretrieve(query_path, output_filename)
if verbose:
print(f"Unpacking {output_filename} into {output_folder}")
shutil.unpack_archive(output_filename, output_folder)
shutil.unpack_archive(output_filename, output_folder, filter="data")
else:
if verbose:
print(f"Reusing {query_path} ({output_filename} already exists)")
Expand Down
41 changes: 30 additions & 11 deletions radas/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,17 @@
@click.option(
"-v", "--verbose", count=True, help="Write additional output to the command line."
)
@click.option(
"--debug",
is_flag=True,
help="Flag to enable debug mode (disables multiprocessing).",
)
def run_radas_cli(
directory: Path,
config: Optional[str],
species: list[str],
verbose: int,
debug: bool,
):
"""Runs the radas program.
Expand All @@ -56,7 +62,13 @@ def run_radas_cli(
If species is given, it must be a valid species name (i.e. 'hydrogen').
Otherwise, all valid species in the config.yaml file are evaluated.
"""
kwargs = dict(directory=directory, config=config, species=species, verbose=verbose)
kwargs = dict(
directory=directory,
config=config,
species=species,
verbose=verbose,
debug=debug,
)
try:
from ipdb import launch_ipdb_on_exception

Expand All @@ -71,6 +83,7 @@ def run_radas(
config: Optional[str],
species: list[str],
verbose: int,
debug: bool,
):

radas_dir = Path(directory)
Expand Down Expand Up @@ -122,16 +135,22 @@ def run_radas(
)

output_dir.mkdir(exist_ok=True, parents=True)
with mp.Pool() as pool:
if species != ("all",):
datasets = {
species_name: datasets[species_name] for species_name in species
}

pool.map(
partial(run_radas_computation, output_dir=output_dir, verbose=verbose),
[(ds) for ds in datasets.values()],
)
if not debug:
with mp.Pool() as pool:
if species != ("all",):
datasets = {
species_name: datasets[species_name] for species_name in species
}

pool.map(
partial(
run_radas_computation, output_dir=output_dir, verbose=verbose
),
[(ds) for ds in datasets.values()],
)
else:
for ds in datasets.values():
run_radas_computation(ds, output_dir=output_dir, verbose=verbose)

if verbose:
print(f"Generating plots and saving output to {output_dir}")
Expand Down

0 comments on commit 24f40e2

Please sign in to comment.