Skip to content

Commit

Permalink
Merge branch 'release-2.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
AnsArn committed Nov 27, 2024
2 parents 73f3d8b + f336a9f commit 8040ce9
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 27 deletions.
2 changes: 1 addition & 1 deletion conda_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy>=1.17.3
numpy>=2.0
pandas>2.0
scipy>=1.1.0
xarray>=0.18.0
Expand Down
2 changes: 1 addition & 1 deletion cosipy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def get_entry_points(package_name: str = "cosipy"):
if sys.version_info >= (3, 10):
entries = entry_points(group="console_scripts")
else:
entries = entries["console_scripts"]
entries = entry_points()["console_scripts"]
entrypoints = (
ep
for ep in entries
Expand Down
4 changes: 4 additions & 0 deletions cosipy/cpkernel/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def __init__(self, DATA=None):
"""

self.atm = self.get_output_variables(Config.output_atm)
# filter out input data, otherwise they get replaced by empty arrays
for input_name in ["T2", "RH2", "U2", "RRR", "N", "G", "PRES"]:
self.atm = [value for value in self.atm if value!=input_name]

self.internal = self.get_output_variables(Config.output_internal)
self.full = self.get_output_variables(Config.output_full)

Expand Down
2 changes: 1 addition & 1 deletion cosipy/utilities/aws2cosipy/aws2cosipy.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def create_2D_input(
aggregates[name] = "mean"
else:
aggregates[name] = "sum"
df = df.resample(_cfg.coords["aggregation_step"].agg(aggregates))
df = df.resample(_cfg.coords["aggregation_step"]).agg(aggregates)

# Load static data
print(f"Read static file {static_file}\n")
Expand Down
40 changes: 21 additions & 19 deletions cosipy/utilities/setup_cosipy/setup_cosipy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Generate sample configuration files for COSIPY.
"""Generate sample configuration files for COSIPY.
Usage:
Expand Down Expand Up @@ -111,30 +110,33 @@ def copy_file_to_target(
"""

target_path = f"{target_dir}/{basename}"
decision = True
source_path = f"{source_dir}/{basename}"
overwrite = True # otherwise no file created if missing

if not silent_overwrite and os.path.isfile(target_path):
decision = input(
f"{basename} already exists in {target_dir}/\nOverwrite?\n"
)
decision = strtobool(decision)
if decision:
shutil.copyfile(
f"{source_dir}/{basename}", target_path, follow_symlinks=True
)
prompt = f"{basename} already exists in {target_dir}/\nReplace target? [y/N] "
overwrite = get_user_confirmation(prompt)
if overwrite:
shutil.copyfile(source_path, target_path, follow_symlinks=True)
else:
print("Skipping...")

def get_user_confirmation(prompt: str) -> bool:
"""Get user confirmation.
def strtobool(val: str) -> bool:
"""Convert user input to bool."""
val = val.lower()
if val in ("y", "yes"):
return True
elif val in ("n", "no"):
return False
Args:
prompt: Prompt to display to user.
Returns:
True if user confirms, False otherwise.
"""
user_input: str = input(prompt).lower().strip()
if user_input not in ("y", "yes", "n", "no", ""):
print("Please enter 'yes' or 'no'.\n")
return get_user_confirmation(prompt)
return user_input in ("y", "yes")

def main():

args = get_user_arguments()

sample_path = get_sample_directory()
Expand Down
2 changes: 1 addition & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy>=1.17.3
numpy>=2.0
pandas>2.0
scipy>=1.1.0
xarray>=0.18.0
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy>=1.17.3
numpy>=2.0
pandas>2.0
scipy>=1.1.0
xarray>=0.18.0
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "cosipymodel"
version = "2.0.0"
version = "2.0.1"
authors = [
{ name = "COSIPY Contributors", email = "" },
]
Expand Down Expand Up @@ -33,7 +33,7 @@ classifiers = [
"Topic :: Scientific/Engineering :: Information Analysis",
]
dependencies = [
"numpy>=1.17.3",
"numpy>=2.0",
"pandas>2.0",
"scipy>=1.1.0",
"xarray>=0.18.0",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy>=1.17.3
numpy>=2.0
pandas>2.0
scipy>=1.1.0
xarray>=0.18.0
Expand Down

0 comments on commit 8040ce9

Please sign in to comment.