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

Folder cleanup #77

Merged
merged 4 commits into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
- docker

stages:
# - test
- test
- name: deploy
if: type = pull_request OR branch = main OR tag IS present AND repo = USDA-ARS-NWRC/awsm

Expand Down
21 changes: 8 additions & 13 deletions awsm/data/init_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"""


class modelInit():
class ModelInit():
"""
Class for initializing snow model. Only runs if a model is specified
in the AWSM config.
Expand All @@ -40,17 +40,14 @@ class modelInit():

"""

def __init__(self, logger, cfg, topo, start_wyhr, pathro, pathrr,
pathinit, wy_start):
def __init__(self, logger, cfg, topo, start_wyhr, path_output, wy_start):
"""
Args:
logger: AWSM logger
cfg: AWSM config dictionary
topo: AWSM topo class
start_wyhr: WYHR of run start date
pathro: output directory
pathrr: run<date> directory
pathinit: iSnobal init directory
path_output: run<date> directory
wy_start: datetime of water year start date

"""
Expand All @@ -65,13 +62,11 @@ def __init__(self, logger, cfg, topo, start_wyhr, pathro, pathrr,
if self.init_file is not None:
self.logger.info(
'Using {} to build model init state.'.format(self.init_file))
# iSnobal init directory
self.pathinit = pathinit

# type of model run
self.model_type = cfg['awsm master']['model_type']
# paths
self.pathro = pathro
self.pathrr = pathrr
self.path_output = path_output
# restart parameters
self.restart_crash = cfg['isnobal restart']['restart_crash']
self.restart_hr = cfg['isnobal restart']['wyh_restart_output']
Expand Down Expand Up @@ -134,17 +129,17 @@ def get_crash_init(self):
self.init_type = 'netcdf_out'
# find the correct output folder from which to restart
if self.restart_folder == 'standard':
self.init_file = os.path.join(self.pathrr, 'snow.nc')
self.init_file = os.path.join(self.path_output, 'snow.nc')

elif self.restart_folder == 'daily':
fmt = '%Y%m%d'
# get the date string
day_str = self.pathrr[-8:]
day_str = self.path_output[-8:]
day_dt = pd.to_datetime(day_str) - \
pd.to_timedelta(1, unit='days')
day_dt_str = day_dt.strftime(fmt)
# get the previous day
path_prev_day = os.path.abspath(os.path.join(self.pathrr,
path_prev_day = os.path.abspath(os.path.join(self.path_output,
'..', 'run'+day_dt_str))
self.init_file = os.path.join(path_prev_day, 'snow.nc')

Expand Down
11 changes: 0 additions & 11 deletions awsm/framework/CoreConfig.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ mask_isnobal: default = False,
type = bool,
description = Mask snopack model output.

prompt_dirs: default = False,
type = bool,
description = ask yes or no when making new directories as part
of AWSM structure. This is a failsafe to make sure no
directories are inadvertantly created

[paths]
path_dr: type = criticaldirectory,
description = path to starting drive for AWSM directory
Expand All @@ -31,11 +25,6 @@ path_dr: type = criticaldirectory,
basin: description = name of basin to run. i.e. tuolumne or brb.
No spaces please

isops: default = False,
type = bool,
description = set true of running operational and false if
running development

proj: description = name of project that will be used in directory
structure. No spaces please.

Expand Down
4 changes: 3 additions & 1 deletion awsm/framework/changelog.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[meta]
y
Changes to the AWSM config file
date: 09-14-2020

[changes]
Expand All @@ -8,8 +8,10 @@ date: 09-14-2020
awsm master/make_in -> REMOVED
awsm master/make_nc -> REMOVED
awsm master/snowav_config -> REMOVED
awsm master/prompt_dirs -> REMOVED

# paths
paths/isops -> REMOVED

# grid
grid/nbits -> REMOVED
Expand Down
Loading