Skip to content

Make the tseries directory rather than abort #440

@ekluzek

Description

@ekluzek

New feature type

New infrastructure or infrastructure enhancement

What is this new feature?

adf_info.py aborts if the Time series directory isn't found. Rather than aborting how about it attempt to create the directory?

Assistance required?

No, I will make a PR when the feature is ready

Extra info

Here's the suggested change:

diff --git a/lib/adf_info.py b/lib/adf_info.py
index bb55132..a06c47d 100644
--- a/lib/adf_info.py
+++ b/lib/adf_info.py
@@ -1078,8 +1078,8 @@ def get_climo_yrs_from_ts(self, input_ts_loc, case_name):
 
         #Check that time series input directory actually exists:
         if not input_location.is_dir():
-            errmsg = f"\t ERROR: Time series directory '{input_ts_loc}' not found.  Script is exiting."
-            raise AdfError(errmsg)
+            print( f"\tINFO: Time series directory '{input_location}' not found, making new time series location")
+            input_location.mkdir(parents=True)
 
         # Search for first available variable in var_list to get a time series file to read
         # NOTE: it is assumed all the variables have the same dates!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions