diff --git a/src/Utility/Pre-Processing/STOFS-3D-Atl-operation/Source_sink/v7/gen_sourcesink.py b/src/Utility/Pre-Processing/STOFS-3D-Atl-operation/Source_sink/v7/gen_sourcesink.py index a8f4ff670..7b0d65a73 100644 --- a/src/Utility/Pre-Processing/STOFS-3D-Atl-operation/Source_sink/v7/gen_sourcesink.py +++ b/src/Utility/Pre-Processing/STOFS-3D-Atl-operation/Source_sink/v7/gen_sourcesink.py @@ -41,8 +41,12 @@ def main(): # startdate = datetime(2024, 3, 5) # ------------------------- hardwired inputs for operation-------------------------- - working_dir = '/sciclone/schism10/feiye/STOFS3D-v7/I12w/Source_sink/relocated_source_sink2/' - nwm_folder = '/sciclone/schism10/feiye/STOFS3D-v7/I12w/Source_sink/original_source_sink/20240305/' + #zy-working_dir = '/sciclone/schism10/feiye/STOFS3D-v7/I12w/Source_sink/relocated_source_sink2/' + #zy-nwm_folder = '/sciclone/schism10/feiye/STOFS3D-v7/I12w/Source_sink/original_source_sink/20240305/' + working_dir = './' + nwm_folder = './' + + layer = 'conus' # ------------------------- end hardwired inputs-------------------------- diff --git a/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Bathy_edit/bathy_edit.py b/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Bathy_edit/bathy_edit.py index f685d8e15..5f6c75b51 100755 --- a/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Bathy_edit/bathy_edit.py +++ b/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Bathy_edit/bathy_edit.py @@ -50,7 +50,7 @@ 'Feeder', # set feeder channel depth, relative, datum doesn't matter ] -DEFAULT_TASKS = {'Regional_tweaks', 'NCF', 'Levee'} +DEFAULT_TASKS = {'Regional_tweaks', 'NCF', 'Levee', 'xGEOID'} # larger files not included in the Git repository, need to be copied to the working directory LARGE_FILES = { @@ -245,10 +245,9 @@ def sample_usage(): ''' Sample usage of the bathy_edit function. ''' - WDIR = Path('/sciclone/schism10/feiye/STOFS3D-v8/I10/Bathy_edit2/') + WDIR = Path('/sciclone/schism10/feiye/STOFS3D-v8/I14/Bathy_edit/') HGRID_FNAME = Path( # Typically, this is the DEM-loaded hgrid - '/sciclone/schism10/feiye/STOFS3D-v8/I10/Bathy_edit/' - 'DEM_loading/hgrid.ll.dem_loaded.mpi.gr3' + '/sciclone/schism10/feiye/STOFS3D-v8/I14/09b.gr3' ) TASKS = ['xGEOID'] diff --git a/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Bathy_edit/xGEOID/convert2xgeoid.py b/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Bathy_edit/xGEOID/convert2xgeoid.py index eca960c0a..e54b827a8 100644 --- a/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Bathy_edit/xGEOID/convert2xgeoid.py +++ b/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Bathy_edit/xGEOID/convert2xgeoid.py @@ -32,9 +32,9 @@ def prep_folder(wdir): os.chdir(wdir) # copy over the polygons - source_path = ('/sciclone/schism10/hjyoo/task/task6_SECOFS/' - 'simulation/Whole_Domain/Grid/Script/xGEOID/VDatum_polygons/') - os.system(f'cp -rL {source_path} .') + # source_path = ('/sciclone/schism10/hjyoo/task/task6_SECOFS/' + # 'simulation/Whole_Domain/Grid/Script/xGEOID/VDatum_polygons/') + # os.system(f'cp -rL {source_path} .') def generate_input_txt(hgrid_obj, wdir, n_sub=500000): diff --git a/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Source_sink/NWM/gen_sourcesink_nwm.py b/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Source_sink/NWM/gen_sourcesink_nwm.py index a3497249d..3e73f50c5 100644 --- a/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Source_sink/NWM/gen_sourcesink_nwm.py +++ b/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Source_sink/NWM/gen_sourcesink_nwm.py @@ -36,7 +36,7 @@ def gen_sourcesink_nwm(startdate: datetime, rnday: float, cache_folder: Path = N output_directory = Path.cwd() # input directory which saves nc files - if cache_folder is not None and cache_folder.exists(): # if cache folder exists, use it + if cache_folder is not None and os.path.exists(cache_folder): # if cache folder exists, use it cache = cache_folder else: # if cache folder does not exist, create it cache = Path(f'./{startdate.strftime("%Y%m%d")}') diff --git a/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Source_sink/Replace_with_USGS/replace_with_obs.py b/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Source_sink/Replace_with_USGS/replace_with_obs.py index 0616aa1ff..42146f505 100644 --- a/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Source_sink/Replace_with_USGS/replace_with_obs.py +++ b/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/Source_sink/Replace_with_USGS/replace_with_obs.py @@ -450,10 +450,15 @@ def source_nwm2usgs( ) # build df nwm_df = pd.DataFrame({'datetime': my_date_range}).join(pd.DataFrame(stream_flow, columns=fid_subset)) + # assign utc time zone + nwm_df['datetime'] = nwm_df['datetime'].dt.tz_localize('UTC') nwm_df = nwm_df.loc[:, ~nwm_df.columns.duplicated()] # drop duplicate columns # nwm_df = nwm_df.set_index('datetime').resample("H").mean() # nwm_df = nwm_df.interpolate(method='time') # fill in missing data + # set datetime as index + nwm_df = nwm_df.set_index('datetime') + print(f'---------------reading nwm data took: {time.time()-t1} s ---------------\n') # ----------------------------------------------------------------------------------- @@ -505,9 +510,7 @@ def source_nwm2usgs( print(f'warning: source {i}_{my_source.hgrid_ie} does not have nearby usgs obs') continue - this_vsource_nwm_array = nwm_df[mysrc_nwm_fid].to_numpy() - - # interpolate usgs to vsource/nwm time + # interpolate usgs to vsource time this_vs_usgs_array = np.zeros((nrec, len(mysrc_usgs_id)), dtype=float) for k, idx in enumerate(mysrc_usgs_idx): this_vs_usgs_array[:, k] = np.interp( @@ -516,10 +519,21 @@ def source_nwm2usgs( my_obs.stations[idx].df.iloc[:, 1].to_numpy()*0.028316847 ) + # this_vsource_nwm_array = nwm_df[mysrc_nwm_fid].to_numpy() + this_vsource_nwm_array = np.zeros((nrec, len(mysrc_nwm_fid)), dtype=float) + # interpolate nwm to vsource time + for k, idx in enumerate(mysrc_nwm_fid): + this_vsource_nwm_array[:, k] = np.interp( + (df.index - df.index[0]).total_seconds().to_numpy(), + (nwm_df.index - df.index[0]).total_seconds().to_numpy(), + nwm_df[mysrc_nwm_fid].to_numpy().squeeze() + ) + + plt.figure(figsize=(10, 6)) plt.plot(df.index, df['Data'], '.k', label="original vsource") for k, usgs_id in enumerate(mysrc_usgs_id): - plt.plot(df.index, this_vs_usgs_array[:, k], linestyle1[k], label=f'usgs {usgs_id}') - plt.plot(df.index, this_vsource_nwm_array[:, k], linestyle2[k], label=f'NWM near usgs {usgs_id}') + plt.plot(df.index, this_vs_usgs_array[:, k], linestyle1[k], linewidth=0.5, label=f'usgs {usgs_id}') + plt.plot(df.index, this_vsource_nwm_array[:, k], linestyle2[k], linewidth=0.5, label=f'NWM near usgs {usgs_id}') # take the diff (including all relavant usgs-nwm pairs found) diff_usgs_nwm = this_vs_usgs_array - this_vsource_nwm_array @@ -543,10 +557,18 @@ def source_nwm2usgs( if __name__ == "__main__": # sample usage (the final product is "adjusted_vsource.th" in the output_dir): + # source_nwm2usgs( + # start_time_str="2024-03-05 00:00:00", + # f_shapefile="/sciclone/schism10/Hgrid_projects/STOFS3D-v8/v20p2s2_RiverMapper/shapefiles/LA_nwm_v1p2.shp", + # original_ss_dir='/sciclone/schism10/feiye/STOFS3D-v8/I09/Source_sink/original_source_sink/', + # nwm_data_dir='/sciclone/schism10/feiye/STOFS3D-v8/I09/Source_sink/original_source_sink/20240305/', + # output_dir='/sciclone/schism10/feiye/STOFS3D-v8/I09/Source_sink/USGS_adjusted_sources/', + # ) + source_nwm2usgs( - start_time_str="2024-03-05 00:00:00", + start_time_str="2017-12-01 00:00:00", f_shapefile="/sciclone/schism10/Hgrid_projects/STOFS3D-v8/v20p2s2_RiverMapper/shapefiles/LA_nwm_v1p2.shp", - original_ss_dir='/sciclone/schism10/feiye/STOFS3D-v8/I09/Source_sink/original_source_sink/', - nwm_data_dir='/sciclone/schism10/feiye/STOFS3D-v8/I09/Source_sink/original_source_sink/20240305/', - output_dir='/sciclone/schism10/feiye/STOFS3D-v8/I09/Source_sink/USGS_adjusted_sources/', + original_ss_dir='/sciclone/schism10/feiye/STOFS3D-v8/I14/Source_sink/USGS_adjusted_sources/original/', + nwm_data_dir='/sciclone/schism10/feiye/STOFS3D-v8/I13/Source_sink/original_source_sink/20171201/', + output_dir='/sciclone/schism10/feiye/STOFS3D-v8/I14/Source_sink/USGS_adjusted_sources/', ) diff --git a/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/stofs3d_atl_config.py b/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/stofs3d_atl_config.py index cbeb4e4f2..1ade0c73e 100644 --- a/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/stofs3d_atl_config.py +++ b/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/stofs3d_atl_config.py @@ -21,6 +21,7 @@ def __init__( self, startdate=datetime(2017, 12, 1), # start date of the model rnday=60, # number of days to run the model + ocean_bnd_ids=[0], # list of open boundary ids for *D.th.nc elev2d_uniform_shift=0.0, # add a uniform shift to elev2D nudging_zone_width=1.5, # in degrees nudging_day=1.0, # in days @@ -40,6 +41,7 @@ def __init__( self.startdate = startdate self.rnday = rnday + self.ocean_bnd_ids = ocean_bnd_ids self.elev2d_uniform_shift = elev2d_uniform_shift self.nudging_zone_width = nudging_zone_width self.nudging_day = nudging_day @@ -110,6 +112,7 @@ def v6(cls): '/sciclone/schism10/feiye/STOFS3D-v5/Inputs/v14/Parallel/' 'SMS_proj/feeder/feeder.pkl'), mandatory_sources_coor=rsf.v19p2_mandatory_sources_coor, + ocean_bnd_ids=[0, 1], bc_flags=[[5, 5, 4, 4]], tvd_regions=[ 'tvd0_1.reg', 'tvd0_2.reg', 'tvd0_3.reg', 'tvd0_4.reg', @@ -122,6 +125,7 @@ def v6(cls): def v7(cls): '''Factory method to create a configuration for STOFS3D-v7''' return cls( + ocean_bnd_ids=[0, 1], elev2d_uniform_shift=-0.42, # add a uniform shift to elev2D nudging_zone_width=7.3, # default nudging zone shapiro_zone_width=11.5, # default shapiro zone @@ -157,6 +161,7 @@ def v7(cls): def v7_hercules_test(cls): '''Factory method to create a configuration for STOFS3D-v7 2D setup''' return cls( + ocean_bnd_ids=[0, 1], elev2d_uniform_shift=-0.42, # add a uniform shift to elev2D nudging_zone_width=7.3, # default nudging zone shapiro_zone_width=11.5, # default shapiro zone @@ -183,19 +188,23 @@ def v7_hercules_test(cls): def v8_louisianna(cls): '''Factory method to create a configuration for STOFS3D-v8's local test in Louisianna''' return cls( + ocean_bnd_ids=[0], nudging_zone_width=0, # default nudging zone shapiro_zone_width=0, # default shapiro zone shapiro_tilt=0, # default abrupt transition in the shapiro zone feeder_info_file='', relocate_source=False, nwm_cache_folder=Path('/sciclone/schism10/whuang07/schism20/NWM_v2.1/'), - bc_flags=[[5, 5, 4, 4]] + bc_flags=[[5, 3, 0, 0]], + bc_relax=[[None, None, None, None]], + bc_const=[[None, None, None, None]], ) @classmethod def v8(cls): '''Factory method to create a configuration for STOFS3D-v8 3D setup''' return cls( + ocean_bnd_ids=[0, 1], elev2d_uniform_shift=-0.42, # add a uniform shift to elev2D nudging_zone_width=7.3, # default nudging zone shapiro_zone_width=11.5, # default shapiro zone diff --git a/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/stofs3d_atl_driver.py b/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/stofs3d_atl_driver.py index fdd9f6e36..73b92fb8c 100755 --- a/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/stofs3d_atl_driver.py +++ b/src/Utility/Pre-Processing/STOFS-3D-Atl-shadow-VIMS/Pre_processing/stofs3d_atl_driver.py @@ -30,6 +30,18 @@ The script will prepare the model folders and keep a record of itself in the model input folder. + +For the author, there are a few "todo" items in the script. +1) The second call to gen_sourcesink_nwm is not optimal, because it downloads + the NWM data again if config.nwm_cache_folder is not set. + This cost time for longer runs. + It is better to directly use generated sources/sinks. + As a temporary solution, run the script with config.relocate_source = False, + locate the downloaded data in {model_input_path}/Source_sink/original_source_sink/, + symlink all downloaded NWM data in a single folder and set config.nwm_cache_folder. + The symlink is necessary because NWM data may be stored in subfolders of different years. + +2) hotstart.nc ''' @@ -215,12 +227,18 @@ def gen_nudge_coef(hgrid: pylib.schism_grid, rlmax=1.5, rnu_day=0.25, open_bnd_l return nudge_coeff -def gen_3dbc(hgrid_fname, vgrid_fname, outdir, start_date, rnday): +def gen_3dbc( + hgrid_fname, vgrid_fname, outdir, start_date, rnday, + ocean_bnd_ids=None, max_attempts=10 +): """ Generate 3D boundary conditions based on the HYCOM data Sometimes the server can be busy, and the connection may be lost. """ + if ocean_bnd_ids is None: + raise ValueError("ocean_bnd_ids must be specified, e.g., [0, 1]") + # check input files if not os.path.exists(hgrid_fname): raise FileNotFoundError(f'{hgrid_fname} not found') @@ -233,33 +251,38 @@ def gen_3dbc(hgrid_fname, vgrid_fname, outdir, start_date, rnday): ) logger = logging.getLogger('pyschism') logger.setLevel(logging.INFO) - - max_attempts = 10 - restart = False # first attempt doesn't need "restart" hgrid = Hgrid.open(hgrid_fname, crs='epsg:4326') bnd = OpenBoundaryInventoryHYCOM(hgrid, vgrid_fname) - - nattempts = max_attempts - while nattempts > 0: + + restart = False # First attempt doesn't need "restart" + last_error = None # To store the last exception + for attempt in range(max_attempts): try: - if nattempts < max_attempts: - restart = True # continue from the last attempt bnd.fetch_data( outdir, start_date, rnday, elev2D=True, TS=True, UV=True, - ocean_bnd_ids=[0, 1], restart=restart + ocean_bnd_ids=ocean_bnd_ids, + restart=restart ) - break # Exit the loop if fetch_data is successful - except Exception as e: - nattempts -= 1 - print(f"Attempt failed: {e}. Retrying... ({nattempts} attempts left)") - - if nattempts == 0: - raise Exception(f"Failed to fetch 3D boundary conditions after {max_attempts} attempts") + return # Successful fetch + except Exception as e: # Replace with specific exceptions + last_error = e + restart = True + print(f"Attempt failed: {e}. Retrying..." + f" ({max_attempts-attempt-1} attempts left)") + + # Raise an exception after exhausting all retries + raise Exception( + f"Failed to fetch 3D boundary conditions after {max_attempts} attempts. " + f"Last error: {last_error}" + ) -def gen_elev2d(hgrid_fname, outdir, start_date, rnday, uniform_shift=0.0): +def gen_elev2d( + hgrid_fname, outdir, start_date, rnday, + ocean_bnd_ids=None, uniform_shift=0.0 +): ''' Generate 2D elevation boundary conditions based on AVISO (CMEMS) data @@ -273,6 +296,8 @@ def gen_elev2d(hgrid_fname, outdir, start_date, rnday, uniform_shift=0.0): A uniform shift can be applied to the elevation data, e.g., -0.42 m in STOFS-3D v7 ''' + if ocean_bnd_ids is None: + raise ValueError("ocean_bnd_ids must be specified, e.g., [0, 1]") if not os.path.exists(hgrid_fname): raise FileNotFoundError(f'{hgrid_fname} not found') # enable pyschism's logging @@ -296,7 +321,8 @@ def gen_elev2d(hgrid_fname, outdir, start_date, rnday, uniform_shift=0.0): hgrid = Hgrid.open(hgrid_fname, crs='epsg:4326') bnd = OpenBoundaryInventoryAVISO(hgrid) - bnd.fetch_data(outdir, start_date, rnday, ocean_bnd_ids=[0, 1], elev2D=True) + bnd.fetch_data( + outdir, start_date, rnday, ocean_bnd_ids=ocean_bnd_ids, elev2D=True) # modify the elevation data based on the uniform shift if np.abs(uniform_shift) > 1e-6: @@ -314,20 +340,39 @@ def gen_elev2d(hgrid_fname, outdir, start_date, rnday, uniform_shift=0.0): # ds.to_netcdf(f'{outdir}/elev2D.th.nc', engine="netcdf4") -def gen_nudge_stofs(hgrid_fname, vgrid_fname, outdir, start_date, rnday): +def gen_nudge_stofs( + hgrid_fname, vgrid_fname, outdir, start_date, rnday, + ocean_bnd_ids=None, max_retry=10 +): ''' Generate nudge coefficient, adapted from pyschism's sample script ''' + if ocean_bnd_ids is None: + raise ValueError("ocean_bnd_ids must be specified, e.g., [0, 1]") + hgrid = Hgrid.open(hgrid_fname, crs='epsg:4326') # ocean_bnd_ids - segment indices, starting from zero. - nudge = Nudge(hgrid=hgrid, ocean_bnd_ids=[0, 1]) + nudge = Nudge(hgrid=hgrid, ocean_bnd_ids=ocean_bnd_ids) + # for nudge.fetch_data: # rlmax - max relax distance in m or degree # rnu_day - max relax strength in days # restart = True will append to the existing nc file, works when first try doesn't break. - nudge.fetch_data(outdir, vgrid_fname, start_date, rnday, restart=False, rnu_day=1, rlmax=7.3) + restart = False + retries_left = max_retry # Keep track of retries separately + while retries_left > 0: + try: + nudge.fetch_data(outdir, vgrid_fname, start_date, rnday, restart=restart, rnu_day=1, rlmax=7.3) + return # Successful fetch + except Exception as e: # Replace with specific exceptions as needed + retries_left -= 1 + print(f"Attempt failed: {e}. Retrying... ({retries_left} attempts left)") + restart = True + + # Include the last exception in the error message + raise Exception(f"Failed to fetch nudge coefficient after {max_retry} attempts. Last error: {e}") def gen_drag(hgrid: pylib.schism_grid): @@ -484,17 +529,16 @@ def main(): # -----------------input--------------------- # hgrid generated by SMS, pre-processed, and converted to *.gr3 - hgrid_path = ('/sciclone/schism10/feiye/STOFS3D-v8/I11/hgrid.gr3') - # hgrid_path = ('/work/noaa/nosofs/feiye/Runs/R16x/hgrid.gr3') + hgrid_path = '/sciclone/schism10/feiye/STOFS3D-v8/I09/hgrid.gr3' # get a configuration preset and make changes if necessary # alternatively, you can set the parameters directly on an # new instance of ConfigStofs3dAtlantic - config = ConfigStofs3dAtlantic.v8() + config = ConfigStofs3dAtlantic.v8_louisianna() config.rnday = 3 - config.startdate = datetime(2024, 3, 5) - config.nwm_cache_folder = Path( - '/sciclone/schism10/feiye/STOFS3D-v8/I09/Source_sink/original_source_sink/20240305/') + config.startdate = datetime(2017, 12, 1) + config.nwm_cache_folder = ('/sciclone/schism10/feiye/STOFS3D-v8/I13/' + 'Source_sink/original_source_sink/20171201/') # define the project dir, where the run folders are located project_dir = '/sciclone/schism10/feiye/STOFS3D-v8/' @@ -505,7 +549,7 @@ def main(): # R{runid}: run directory, where the run will be submitted to queue; # O{runid}: output directory for holding raw outputs and post-processing. # under project_dir - runid = '11y' + runid = '14' # swithes to generate different input files input_files = { @@ -519,8 +563,8 @@ def main(): 'source_sink': False, 'hotstart.nc': False, '3D.th.nc': False, - 'elev2D.th.nc': True, - '*nu.nc': False, + 'elev2D.th.nc': False, + '*nu.nc': True, '*.prop': False, } # -----------------end input--------------------- @@ -688,15 +732,15 @@ def main(): sub_dir = 'Source_sink' print(f'{DRIVER_PRINT_PREFIX}Generating source_sink.in ...') - # mkcd_new_dir(f'{model_input_path}/{sub_dir}') + mkcd_new_dir(f'{model_input_path}/{sub_dir}') - # # generate source_sink files by intersecting NWM river segments - # # with the model land boundary - # mkcd_new_dir(f'{model_input_path}/{sub_dir}/original_source_sink/') - # os.symlink(f'{model_input_path}/hgrid.gr3', 'hgrid.gr3') - # gen_sourcesink_nwm( - # startdate=config.startdate, rnday=config.rnday, - # cache_folder=config.nwm_cache_folder) + # generate source_sink files by intersecting NWM river segments + # with the model land boundary + mkcd_new_dir(f'{model_input_path}/{sub_dir}/original_source_sink/') + os.symlink(f'{model_input_path}/hgrid.gr3', 'hgrid.gr3') + gen_sourcesink_nwm( + startdate=config.startdate, rnday=config.rnday, + cache_folder=config.nwm_cache_folder) # relocate source locations to resolved river channels, the result is the "base" source/sink if config.relocate_source: @@ -713,6 +757,9 @@ def main(): ) # regenerate source/sink based on relocated sources.json and sinks.json os.symlink('../original_source_sink/sinks.json', 'sinks.json') # dummy + # todo: use existing sources/sinks instead of calling gen_sourcesink_nwm + # to save time and avoid potential errors in the future when + # some sources are adjusted before this step gen_sourcesink_nwm( startdate=config.startdate, rnday=config.rnday, cache_folder=config.nwm_cache_folder) @@ -777,6 +824,7 @@ def main(): mkcd_new_dir(f'{model_input_path}/{sub_dir}') # generate hotstart.nc + # todo: implement this function raise NotImplementedError('hotstart.nc is not implemented yet') # -----------------3D.th.nc--------------------- @@ -790,7 +838,8 @@ def main(): hgrid_fname=f'{model_input_path}/hgrid.gr3', vgrid_fname=f'{model_input_path}/vgrid.in', outdir=f'{model_input_path}/{sub_dir}', - start_date=config.startdate, rnday=config.rnday + start_date=config.startdate, rnday=config.rnday, + ocean_bnd_ids=config.ocean_bnd_ids, ) os.chdir(run_dir) @@ -806,7 +855,8 @@ def main(): hgrid_fname=f'{model_input_path}/hgrid.gr3', outdir=f'{model_input_path}/{sub_dir}', start_date=config.startdate, rnday=config.rnday, - uniform_shift=config.elev2d_uniform_shift + ocean_bnd_ids=config.ocean_bnd_ids, + uniform_shift=config.elev2d_uniform_shift, ) os.chdir(run_dir) @@ -823,7 +873,8 @@ def main(): hgrid_fname=f'{model_input_path}/hgrid.gr3', vgrid_fname=f'{model_input_path}/vgrid.in', outdir=f'{model_input_path}/{sub_dir}', - rnday=config.rnday, start_date=config.startdate + rnday=config.rnday, start_date=config.startdate, + ocean_bnd_ids=config.ocean_bnd_ids, ) os.chdir(run_dir)