Esempio n. 1
0
 def __get__(self, obj, val):
     tides = obj.__dict__.get('tides')
     if tides is None:
         if not obj.args.all_constituents \
                 and not obj.args.major_constituents \
                 and not obj.args.constituents:
             return
         else:
             tides = Tides(velocity=obj.args.bnd_vel)
             if obj.args.all_constituents:
                 tides.use_all()
             if obj.args.major_constituents:
                 tides.use_major()
             if obj.args.constituents:
                 for constituent in obj.args.constituents:
                     tides.use_constituent(constituent)
         obj.__dict__['tides'] = tides
     return tides
Esempio n. 2
0
if __name__ == '__main__':
    # open gr3 file
    logger.info('Reading hgrid file...')
    _tic = time()
    hgrid = Hgrid.open(PARENT / 'hgrid.gr3', crs='EPSG:4326')
    logger.info(f'Reading hgrind file took {time()-_tic}.')

    vgrid = Vgrid()
    fgrid = Fgrid.open(PARENT / 'drag.gr3', crs='EPSG:4326')

    # setup model domain
    domain = ModelDomain(hgrid, vgrid, fgrid)
    logger.info('Model domain setup finished')

    # set tidal boundary conditions
    elevbc = Tides()
    elevbc.use_all()  # activate all forcing constituents
    logger.info('Tidal boundary setup finished')

    # connect the boundary condition to the domain
    domain.add_boundary_condition(elevbc)

    sflux_1 = GFS()
    # sflux_2 = HWRF()

    atmos = NWS2(sflux_1,
                 #         sflux_2
                 )

    domain.set_atmospheric_forcing(atmos)
Esempio n. 3
0
 def setUp(self):
     self.tf = Tides()
     self.tf.start_date = datetime(2017, 9, 23)
     self.tf.end_date = datetime(2017, 9, 25)
     self.tf.spinup_time = timedelta(days=7)
     self.tf.use_constituent('M2')
Esempio n. 4
0
 def tidal_forcing(self):
     tidal_forcing = Tides()
     for constituent in self.constituents:
         tidal_forcing.use_constituent(constituent)
     return tidal_forcing
Esempio n. 5
0
 def test_set_tides_boundary_forcing_by_id(self):
     h = Mesh.open(self.hgrid)
     from pyschism.forcing import Tides
     h.hgrid.generate_boundaries()
     h.set_boundary_forcing(Tides(), 0)