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

enumerate SCHISM configuration options #94

Open
ghost opened this issue Apr 29, 2021 · 7 comments
Open

enumerate SCHISM configuration options #94

ghost opened this issue Apr 29, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Apr 29, 2021

enumerate possible JSON options for SCHISM, possibly by using the settable parameters for the pyschism API

required for #93

@ghost ghost added the enhancement New feature or request label Apr 29, 2021
@ghost ghost self-assigned this Apr 29, 2021
@ghost
Copy link
Author

ghost commented May 10, 2021

current SCHISM configuration options implemented in coupledmodeldriver as of right now:

field_types = {
'modeled_start_time': datetime,
'modeled_duration': timedelta,
'modeled_timestep': timedelta,
'tidal_spinup_duration': timedelta,
'tidal_bc_spinup_duration': timedelta,
'tidal_bc_cutoff_depth': float,
'stratification': Stratification,
'hotstart_output_interval': timedelta,
'hotstart_combination_executable': Path,
'output_surface': bool,
'surface_output_interval': timedelta,
'surface_output_new_file_skips': int,
'surface_output_variables': {str: bool},
'output_stations': bool,
'stations_output_interval': timedelta,
'stations_file_path': Stations,
'stations_crs': CRS,
}

@ghost
Copy link
Author

ghost commented May 10, 2021

@JaimeCalzadaNOAA I noticed pySCHISM also has a JSON object; we should get together to talk about how to proceed with this configuration

@ghost
Copy link
Author

ghost commented May 10, 2021

instantiation of pySCHISM domain:

@property
def pyschism_domain(self) -> ModelDomain:
domain = ModelDomain(hgrid=self.hgrid, vgrid=self.vgrid, fgrid=self.fgrid)
sflux_forcings = []
for pyschism_forcing in self.pyschism_forcings:
if isinstance(pyschism_forcing, Hydrology):
domain.add_hydrology(pyschism_forcing)
elif isinstance(pyschism_forcing, SfluxDataset):
sflux_forcings.append(pyschism_forcing)
elif isinstance(pyschism_forcing, Tides):
domain.add_boundary_condition(pyschism_forcing)
# TODO add more atmospheric forcings
if len(sflux_forcings) > 0:
if len(sflux_forcings) > 2:
raise NotImplementedError('more than 2 sflux forcings not implemented')
domain.set_atmospheric_forcing(
NWS2(sflux_1=sflux_forcings[0], sflux_2=sflux_forcings[1])
)
return domain

instantiation of pySCHISM model driver:

@property
def pyschism_driver(self) -> ModelDriver:
if self.slurm_configuration is not None:
server_configuration = self.slurm_configuration.to_pyschism
else:
server_configuration = None
surface_output_variables = {
key.value: value for key, value in self['surface_output_variables'].items()
}
driver = ModelDriver(
model_domain=self.pyschism_domain,
dt=self['modeled_timestep'],
rnday=self['modeled_duration'],
ihfskip=self['surface_output_new_file_interval'],
dramp=self['tidal_spinup_duration'],
start_date=self['start_date'],
ibc=self['stratification'],
drampbc=self['tidal_bc_spinup_duration'],
stations=self.pyschism_stations,
nspool=self['surface_output_interval'],
nhot_write=self['hotstart_output_interval'],
server_config=server_configuration,
combine_hotstart=self['hotstart_combination_executable'],
cutoff_depth=self['tidal_bc_cutoff_depth'],
**surface_output_variables,
)
return driver

@ghost
Copy link
Author

ghost commented May 10, 2021

after talking with @JaimeCalzadaNOAA he informed me the the pySCHISM API will change drastically once the spinupforcings branch is merged in

I should implement the following in coupledmodeldriver in preparation for this:

  • using the ModelConfig object to store configuration
  • initializing a hotstart from a previous hotstart

@ghost ghost linked a pull request May 12, 2021 that will close this issue
@ghost
Copy link
Author

ghost commented Jun 15, 2021

@platipodium @josephzhang8 I have a pre-existing JSON configuration system in coupledmodeldriver that enumerates relevant settings per-member (ADCIRC, WW3, GFS mesh, NEMS, etc) for generating configurations. From what I understand, SCHISM already has a file-based configuration system; would it be okay if I incorporated that system in my configuration, if applicable? I'm not sure if it would be overkill.

Here are the configuration options I've drafted so far for a SCHISM JSON config file:

field_types = {
'modeled_start_time': datetime,
'modeled_duration': timedelta,
'modeled_timestep': timedelta,
'tidal_spinup_duration': timedelta,
'tidal_bc_spinup_duration': timedelta,
'tidal_bc_cutoff_depth': float,
'stratification': Stratification,
'hotstart_output_interval': timedelta,
'hotstart_combination_executable': Path,
'output_surface': bool,
'surface_output_interval': timedelta,
'surface_output_new_file_skips': int,
'surface_output_variables': {str: bool},
'output_stations': bool,
'stations_output_interval': timedelta,
'stations_file_path': Stations,
'stations_crs': CRS,
}

@josephzhang8
Copy link

josephzhang8 commented Jun 15, 2021 via email

@jreniel
Copy link

jreniel commented Jun 15, 2021

@zacharyburnettNOAA
Hi Zach,
The first thing I notice is that the API you are using is marked for deprecation. The new API that we have built is much simpler to use, and you should be thinking of the new one instead. It has not been merged to main yet, but it will be soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants