def convert_storm_track(atcf_path): output_path = os.path.join(os.getcwd(), 'katrina.storm') katrina = Storm(path=atcf_path, file_format='ATCF') # Landfall of hurricane 1110 UTC (6:10 a.m. CDT) on Monday, August 29, 2005 katrina.time_offset = datetime.datetime(2005, 8, 29, 11, 10) katrina.write(output_path, file_format='geoclaw') return output_path
def set_storm(rundata): data = rundata.surge_data # Source term controls - These are currently not respected data.wind_forcing = True data.drag_law = 1 data.pressure_forcing = True # Source term algorithm parameters # data.wind_tolerance = 1e-4 # data.pressure_tolerance = 1e-4 # Pressure source term tolerance # AMR parameters data.wind_refine = [20.0,40.0,60.0] # m/s data.R_refine = [60.0e3,40e3,20e3] # m # Storm parameters data.storm_specification_type = "holland80" # Type of storm data.display_landfall_time = True # Storm type 1 - Idealized storm track data.storm_file = os.path.expandvars(os.path.join(os.getcwd(), 'florence.storm')) # Convert ATCF data to GeoClaw format clawutil.data.get_remote_file('http://ftp.nhc.noaa.gov/atcf/archive/2018/bal062018.dat.gz') atcf_path = os.path.join(scratch_dir, 'bal062018.dat') florence = Storm(path=atcf_path, file_format="ATCF") florence.time_offset = datetime.datetime(2018,9,14,7,15) florence.write(data.storm_file, file_format="geoclaw") return data
def set_storm(rundata): data = rundata.surge_data # Source term controls - These are currently not respected data.wind_forcing = True data.drag_law = 1 data.pressure_forcing = True # Source term algorithm parameters # data.wind_tolerance = 1e-4 # data.pressure_tolerance = 1e-4 # Pressure source term tolerance # AMR parameters data.wind_refine = [20.0,40.0,60.0] # m/s data.R_refine = [60.0e3,40e3,20e3] # m # Storm parameters data.storm_specification_type = "holland80" # Type of storm # data.landfall = days2seconds(irene_landfall.days) + irene_landfall.seconds data.display_landfall_time = True # Storm type 1 - Idealized storm track data.storm_file = os.path.expandvars(os.path.join(os.getcwd(),'IRENE.storm')) irene = Storm("irene.storm", file_format='ATCF') irene.time_offset = datetime.datetime(2011,8,27,7,30) irene.write(data.storm_file, file_format="geoclaw") return data
def set_storm(rundata): data = rundata.surge_data # Physics parameters data.rho_air = 1.15 data.ambient_pressure = 101.3e3 # Nominal atmos pressure # Source term controls - These are currently not respected data.wind_forcing = True data.drag_law = 1 data.pressure_forcing = True # Source term algorithm parameters # data.wind_tolerance = 1e-4 # data.pressure_tolerance = 1e-4 # Pressure source term tolerance # AMR parameters data.wind_refine = [20.0, 40.0, 60.0] # m/s data.R_refine = [60.0e3, 40e3, 20e3] # m # Storm parameters data.storm_type = 1 # Type of storm data.landfall = days2seconds(ike_landfall.days) + ike_landfall.seconds data.display_landfall_time = True # Storm type 1 - Idealized storm track #data.storm_file = os.path.expandvars(os.path.join(os.getcwd(),'ike.storm')) # Storm parameters - Parameterized storm (Holland 1980) data.storm_specification_type = 'holland80' # (type 1) data.storm_file = os.path.expandvars(os.path.join(os.getcwd(), 'ike.storm')) # Convert ATCF data to GeoClaw format clawutil.data.get_remote_file( "http://ftp.nhc.noaa.gov/atcf/archive/2008/bal092008.dat.gz") atcf_path = os.path.join(scratch_dir, "bal092008.dat") # Note that the get_remote_file function does not support gzip files which # are not also tar files. The following code handles this with gzip.open(".".join((atcf_path, 'gz')), 'rb') as atcf_file, \ open(atcf_path, 'w') as atcf_unzipped_file: atcf_unzipped_file.write(atcf_file.read().decode('ascii')) # Uncomment/comment out to use the old version of the Ike storm file # ike = Storm(path="old_ike.storm", file_format="ATCF") ike = Storm(path=atcf_path, file_format="ATCF") # Calculate landfall time - Need to specify as the file above does not # include this info (9/13/2008 ~ 7 UTC) ike.time_offset = datetime.datetime(2008, 9, 13, 7) ike.write(data.storm_file, file_format='geoclaw') return rundata
def set_storm(rundata): data = rundata.surge_data # Source term controls data.wind_forcing = True data.pressure_forcing = True data.drag_law = 2 data.display_landfall_time = True # AMR parameters - m/s for wind refinement and (m) for radius data.wind_refine = [20.0, 40.0, 60.0] data.R_refine = [60.0e3, 40e3, 20e3] # Storm parameters - Storm Type 1 is Holland parameterized data.storm_specification_type = 'holland80' data.storm_file = os.path.expandvars( os.path.join(os.getcwd(), 'katrina.storm')) # Convert ATCF data to GeoClaw format clawutil.data.get_remote_file( 'http://ftp.nhc.noaa.gov/atcf/archive/2005/bal122005.dat.gz') atcf_path = os.path.join(scratch_dir, "bal122005.dat") # Note that the get_remote_file function does not support gzip files which # are not also tar files. The following code handles this with gzip.open(".".join((atcf_path, 'gz')), 'rb') as atcf_file, \ open(atcf_path, 'w') as atcf_unzipped_file: atcf_unzipped_file.write(atcf_file.read().decode('ascii')) # Read in the newly downloaded and decompressed file katrina = Storm(path=atcf_path, file_format="ATCF") # Calculate landfall time katrina.time_offset = datetime.datetime(2005, 8, 29, 11, 10) # Write out the storm data into the GeoClaw format katrina.write(data.storm_file, file_format='geoclaw') return data
directory = "data/synthetic_storm_files" if not os.path.exists(os.path.join(os.getcwd(), directory)): os.makedirs(directory) # File to tracy synthetic storm in atcf format tracy_atcf_path = 'data/tracy_synthetic_atcf.storm' # Establish a control form of tracy control = Storm(path=tracy_atcf_path, file_format='ATCF') control.read_atcf(path=tracy_atcf_path) # Change tracy to piece wise constant wind curve u0 = control.max_wind_speed[1] control.max_wind_speed = piecewise_wind_curve(u0, control.max_wind_speed) control.write("data/tracy_geoclaw.storm", file_format="geoclaw") perturbed_radii = [] perturbed_winds = [] # Create storm objects with perturbed wind data for i in range(0, 1000): storm = copy.copy(control) mws = copy.copy(control.max_wind_speed) mws = perturb_wind(mws) C0 = 218.3784 * numpy.ones(len(mws)) mwr = C0 - 1.2014 * mws + (mws / 10.9884)**2 - ( mws / 35.3052)**3 - 145.5090 * numpy.cos( control.eye_location[:, 1] * 0.0174533) storm.max_wind_speed = mws storm.max_wind_radius = mwr
def setgeo(rundata): #------------------- """ Set GeoClaw specific runtime parameters. For documentation see .... """ try: geo_data = rundata.geo_data except: print("*** Error, this rundata has no geodata attribute") raise AttributeError("Missing geodata attribute") # == Physics == geo_data.gravity = 9.81 geo_data.coordinate_system = 2 geo_data.earth_radius = 6367.5e3 geo_data.rho = 1025.0 geo_data.rho_air = 1.15 geo_data.ambient_pressure = 101.3e3 # == Forcing Options geo_data.coriolis_forcing = True geo_data.friction_forcing = True geo_data.friction_depth = 1e10 # == Algorithm and Initial Conditions == geo_data.sea_level = 0.0 geo_data.dry_tolerance = 1.e-2 # Refinement Criteria refine_data = rundata.refinement_data refine_data.wave_tolerance = 1.0 refine_data.speed_tolerance = [1.0, 2.0, 3.0, 4.0] refine_data.deep_depth = 300.0 refine_data.max_level_deep = 4 refine_data.variable_dt_refinement_ratios = True # == settopo.data values == topo_data = rundata.topo_data topo_data.topofiles = [] # for topography, append lines of the form # [topotype, minlevel, maxlevel, t1, t2, fname] topo_path = os.path.join(os.environ["DATA_PATH"], "topography") topo_data.topofiles.append([3, 1, 3, rundata.clawdata.t0, rundata.clawdata.tfinal, os.path.join(topo_path, 'atlantic', 'full_1min.tt3')]) topo_data.topofiles.append([4, 1, 5, rundata.clawdata.t0, rundata.clawdata.tfinal, os.path.join(topo_path, 'new_york_area_3second.nc')]) # == setqinit.data values == rundata.qinit_data.qinit_type = 0 rundata.qinit_data.qinitfiles = [] # for qinit perturbations, append lines of the form: (<= 1 allowed for now!) # [minlev, maxlev, fname] # == setfixedgrids.data values == rundata.fixed_grid_data.fixedgrids = [] # for fixed grids append lines of the form # [t1,t2,noutput,x1,x2,y1,y2,xpoints,ypoints,\ # ioutarrivaltimes,ioutsurfacemax] # ================ # Set Surge Data # ================ data = rundata.surge_data # Source term controls data.wind_forcing = True data.drag_law = 1 data.pressure_forcing = True data.display_landfall_time = True # AMR parameters data.wind_refine = [20.0,40.0,60.0] # m/s data.R_refine = [60.0e3,40e3,20e3] # m # Storm parameters data.storm_specification_type = "holland80" # Set type of storm field data.storm_file = os.path.expandvars(os.path.join(os.getcwd(), 'sandy.storm')) # Convert ATCF data to GeoClaw format clawutil.data.get_remote_file( "http://ftp.nhc.noaa.gov/atcf/archive/2012/bal182012.dat.gz", output_dir=os.getcwd()) atcf_path = os.path.join(os.getcwd(), "bal182012.dat") # Note that the get_remote_file function does not support gzip files which # are not also tar files. The following code handles this with gzip.open(".".join((atcf_path, 'gz')), 'rb') as atcf_file, \ open(atcf_path, 'w') as atcf_unzipped_file: atcf_unzipped_file.write(atcf_file.read().decode('ascii')) sandy = Storm(path=atcf_path, file_format="ATCF") # Calculate landfall time - Need to specify as the file above does not # include this info (9/13/2008 ~ 7 UTC) sandy.time_offset = datetime.datetime(2012,10,30,0,0) sandy.write(data.storm_file, file_format='geoclaw') # ======================= # Set Variable Friction # ======================= data = rundata.friction_data # Variable friction data.variable_friction = True # Region based friction # Entire domain - seems high on land... data.friction_regions.append([rundata.clawdata.lower, rundata.clawdata.upper, [np.infty,0.0,-np.infty], [0.050, 0.025]]) return rundata
def setgeo(rundata): """ Set GeoClaw specific runtime parameters. For documentation see .... """ geo_data = rundata.geo_data # == Physics == geo_data.gravity = 9.81 geo_data.coordinate_system = 2 geo_data.earth_radius = 6367.5e3 geo_data.rho = 1025.0 geo_data.rho_air = 1.15 geo_data.ambient_pressure = 101.3e3 # == Forcing Options geo_data.coriolis_forcing = True geo_data.friction_forcing = True geo_data.friction_depth = 1e10 # == Algorithm and Initial Conditions == # Due to seasonal swelling of gulf we set sea level higher geo_data.sea_level = 0 geo_data.dry_tolerance = 1.e-2 # Refinement Criteria refine_data = rundata.refinement_data refine_data.wave_tolerance = 1.0 refine_data.speed_tolerance = [1.0, 2.0, 3.0, 4.0] refine_data.deep_depth = 300.0 refine_data.max_level_deep = 4 refine_data.variable_dt_refinement_ratios = True # == settopo.data values == topo_data = rundata.topo_data topo_data.topofiles = [] # for topography, append lines of the form # See regions for control over these regions, need better bathy data for # the smaller domains irene_path = os.path.join(DATA, 'irenetopo.tt3') topo_data.topofiles.append( [3, 1, 5, rundata.clawdata.t0, rundata.clawdata.tfinal, irene_path]) # == setfixedgrids.data values == rundata.fixed_grid_data.fixedgrids = [] # for fixed grids append lines of the form # [t1,t2,noutput,x1,x2,y1,y2,xpoints,ypoints,\ # ioutarrivaltimes,ioutsurfacemax] # ================ # Set Surge Data # ================ data = rundata.surge_data # Source term controls data.wind_forcing = True data.drag_law = 1 data.pressure_forcing = True data.display_landfall_time = True # AMR parameters, m/s and m respectively data.wind_refine = [20.0, 40.0, 60.0] data.R_refine = [60.0e3, 40e3, 20e3] # Storm parameters - Parameterized storm (Holland 1980) data.storm_specification_type = 'holland80' # (type 1) data.storm_file = os.path.expandvars( os.path.join(os.getcwd(), 'irene.storm')) # Convert ATCF data to GeoClaw format clawutil.data.get_remote_file( "http://ftp.nhc.noaa.gov/atcf/archive/2011/bal092011.dat.gz") atcf_path = os.path.join(DATA, "bal092011.dat") # Note that the get_remote_file function does not support gzip files which # are not also tar files. The following code handles this with gzip.open(".".join((atcf_path, 'gz')), 'rb') as atcf_file, \ open(atcf_path, 'w') as atcf_unzipped_file: atcf_unzipped_file.write(atcf_file.read().decode('ascii')) irene = Storm(path=atcf_path, file_format="ATCF") # Calculate landfall time - Need to specify as the file above does not # include this info (9/13/2008 ~ 7 UTC) irene.time_offset = datetime.datetime(2011, 8, 27, 12) irene.write(data.storm_file, file_format='geoclaw') # ======================= # Set Variable Friction # ======================= data = rundata.friction_data # Variable friction data.variable_friction = True # Region based friction # Entire domain data.friction_regions.append([ rundata.clawdata.lower, rundata.clawdata.upper, [np.infty, 0.0, -np.infty], [0.030, 0.022] ]) # La-Tex Shelf data.friction_regions.append([(-98, 25.25), (-90, 30), [np.infty, -10.0, -200.0, -np.infty], [0.030, 0.012, 0.022]]) return rundata
def setgeo(rundata): """ Set GeoClaw specific runtime parameters. For documentation see .... """ geo_data = rundata.geo_data # == Physics == geo_data.gravity = 9.81 geo_data.coordinate_system = 1 geo_data.earth_radius = 6367.5e3 geo_data.rho = 1025.0 geo_data.rho_air = 1.15 geo_data.ambient_pressure = 101.3e3 # == Forcing Options geo_data.coriolis_forcing = True geo_data.theta_0 = 25.0 # Beta-plane approximation center geo_data.friction_forcing = True geo_data.friction_depth = 1e10 # == Algorithm and Initial Conditions == # Due to seasonal swelling of gulf we set sea level higher geo_data.sea_level = 0.0 geo_data.dry_tolerance = 1.e-2 # Refinement Criteria refine_data = rundata.refinement_data refine_data.wave_tolerance = 1.0 refine_data.speed_tolerance = [1.0, 2.0, 3.0, 4.0] refine_data.variable_dt_refinement_ratios = True # == settopo.data values == topo_data = rundata.topo_data topo_data.topofiles = [] # for topography, append lines of the form # [topotype, fname] topo_data.topofiles.append([2, 'topo.tt2']) # == setfixedgrids.data values == rundata.fixed_grid_data.fixedgrids = [] # for fixed grids append lines of the form # [t1,t2,noutput,x1,x2,y1,y2,xpoints,ypoints,\ # ioutarrivaltimes,ioutsurfacemax] # ================ # Set Surge Data # ================ data = rundata.surge_data # Source term controls data.wind_forcing = True data.drag_law = 1 data.pressure_forcing = True data.wind_index = 2 data.pressure_index = 4 data.display_landfall_time = True # AMR parameters, m/s and m respectively data.wind_refine = [20.0, 40.0, 60.0] data.R_refine = [60.0e3, 40e3, 20e3] # Storm parameters - Parameterized storm (Holland 1980) data.storm_specification_type = 'holland80' # (type 1) data.storm_file = os.path.expandvars(os.path.join(os.getcwd(), 'fake.storm')) # Contruct storm forward_velocity = units.convert(20, 'km/h', 'm/s') theta = 0.0 * numpy.pi / 180.0 # degrees from horizontal to radians my_storm = Storm() # Take seconds and time period of 30 minutes and turn them into datatimes t_ref = datetime.datetime.now() t_sec = numpy.arange(-RAMP_UP_TIME, rundata.clawdata.tfinal, 30.0 * 60.0) my_storm.t = [t_ref + datetime.timedelta(seconds=t) for t in t_sec] ramp_func = lambda t: (t + (2 * RAMP_UP_TIME)) * (t < 0) / (2 * RAMP_UP_TIME) \ + numpy.ones(t_sec.shape) * (t >= 0) my_storm.time_offset = t_ref my_storm.eye_location = numpy.empty((t_sec.shape[0], 2)) my_storm.eye_location[:, 0] = forward_velocity * t_sec * numpy.cos(theta) my_storm.eye_location[:, 1] = forward_velocity * t_sec * numpy.sin(theta) my_storm.max_wind_speed = units.convert(56, 'knots', 'm/s') * ramp_func(t_sec) my_storm.central_pressure = units.convert(1024, "mbar", "Pa") \ - (units.convert(1024, "mbar", "Pa") \ - units.convert(950, 'mbar', 'Pa')) \ * ramp_func(t_sec) my_storm.max_wind_radius = [units.convert(8, 'km', 'm')] * t_sec.shape[0] my_storm.storm_radius = [units.convert(100, 'km', 'm')] * t_sec.shape[0] my_storm.write(data.storm_file, file_format="geoclaw") # ======================= # Set Variable Friction # ======================= data = rundata.friction_data # Variable friction data.variable_friction = False data.friction_index = 1 return rundata
def setgeo(rundata): #------------------- """ Set GeoClaw specific runtime parameters. For documentation see .... """ try: geo_data = rundata.geo_data except: print("*** Error, this rundata has no geodata attribute") raise AttributeError("Missing geodata attribute") # == Physics == geo_data.gravity = 9.81 geo_data.coordinate_system = 2 geo_data.earth_radius = 6367.5e3 geo_data.rho = 1025.0 geo_data.rho_air = 1.15 geo_data.ambient_pressure = 101.3e3 # == Forcing Options geo_data.coriolis_forcing = True geo_data.friction_forcing = True geo_data.friction_depth = 1e10 # == Algorithm and Initial Conditions == geo_data.sea_level = 0.33 geo_data.dry_tolerance = 1.e-2 # Refinement Criteria refine_data = rundata.refinement_data refine_data.wave_tolerance = 1.0 refine_data.speed_tolerance = [1.0, 2.0, 3.0, 4.0] refine_data.deep_depth = 300.0 refine_data.max_level_deep = 4 refine_data.variable_dt_refinement_ratios = True # == settopo.data values == topo_data = rundata.topo_data topo_data.topofiles = [] # for topography, append lines of the form # [topotype, minlevel, maxlevel, t1, t2, fname] topo_path = '../bathy' topo_data.topofiles.append([3, 1, 3, days2seconds(-2), days2seconds(1), os.path.join(topo_path,'atlantic_1min.tt3')]) topo_data.topofiles.append([3, 1, 3, days2seconds(-2), days2seconds(1), os.path.join(topo_path,'newyork_3s.tt3')]) # restrict these make max lower and for all time # for file in glob.glob("../bathy/*.nc"): topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc41x00_74x00.nc')]) topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc40x75_74x00.nc')]) topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc40x50_74x00.nc')]) topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc40x75_73x75.nc')]) # topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc40x75_73x50.nc')]) # topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc41x00_73x25.nc')]) # topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'montauk_13.nc')]) # topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc40x75_73x25.nc')]) # topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc41x25_74x00.nc')]) # topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc41x25_73x75.nc')]) # topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc41x25_73x50.nc')]) # topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc41x25_73x25.nc')]) # topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc41x00_73x75.nc')]) # topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc41x00_73x50.nc')]) # topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc40x75_73x00.nc')]) # topo_data.topofiles.append([4, 1, 6, days2seconds(-0.45),days2seconds(0.46),os.path.join(topo_path,'nc41x00_73x00.nc')]) #print(topo_data.topofiles) # == setqinit.data values == rundata.qinit_data.qinit_type = 0 rundata.qinit_data.qinitfiles = [] # for qinit perturbations, append lines of the form: (<= 1 allowed for now!) # [minlev, maxlev, fname] # == setfixedgrids.data values == rundata.fixed_grid_data.fixedgrids = [] # for fixed grids append lines of the form # [t1,t2,noutput,x1,x2,y1,y2,xpoints,ypoints,\ # ioutarrivaltimes,ioutsurfacemax] # ================ # Set Surge Data # ================ data = rundata.surge_data # Source term controls data.wind_forcing = True data.drag_law = 1 data.pressure_forcing = True data.display_landfall_time = True # AMR parameters data.wind_refine = [20.0,40.0,60.0] # m/s data.R_refine = [60.0e3,40e3,20e3] # m # Storm parameters data.storm_specification_type = "holland80" # Set type of storm field data.storm_file = os.path.expandvars(os.path.join(os.getcwd(), 'sandy.storm')) # Convert ATCF data to GeoClaw format clawutil.data.get_remote_file( "http://ftp.nhc.noaa.gov/atcf/archive/2012/bal182012.dat.gz", output_dir=os.getcwd()) atcf_path = os.path.join(os.getcwd(), "bal182012.dat") # Note that the get_remote_file function does not support gzip files which # are not also tar files. The following code handles this with gzip.open(".".join((atcf_path, 'gz')), 'rb') as atcf_file: with open(atcf_path, 'w') as atcf_unzipped_file: atcf_unzipped_file.write(atcf_file.read().decode('ascii')) sandy = Storm(path=atcf_path, file_format="ATCF") # Calculate landfall time - Need to specify as the file above does not # include this info (9/13/2008 ~ 7 UTC) sandy.time_offset = datetime.datetime(2012,10,30,0,0) sandy.write(data.storm_file, file_format='geoclaw') # ======================= # Set Variable Friction # ======================= data = rundata.friction_data # Variable friction data.variable_friction = True # Region based friction # Entire domain - seems high on land... data.friction_regions.append([rundata.clawdata.lower, rundata.clawdata.upper, [np.infty,0.0,-np.infty], [0.050, 0.025]]) return rundata
def setgeo(rundata): """ Set GeoClaw specific runtime parameters. For documentation see .... """ try: geo_data = rundata.geo_data except: print("*** Error, this rundata has no geo_data attribute") raise AttributeError("Missing geo_data attribute") # == Physics == geo_data.gravity = 9.81 geo_data.coordinate_system = 2 geo_data.earth_radius = 6367.5e3 geo_data.rho = 1025.0 geo_data.rho_air = 1.15 geo_data.ambient_pressure = 101.3e3 # == Forcing Options geo_data.coriolis_forcing = True geo_data.friction_forcing = True geo_data.friction_depth = 1e10 # == Algorithm and Initial Conditions == geo_data.sea_level = 0.0 geo_data.dry_tolerance = 1.e-2 # Refinement Criteria refine_data = rundata.refinement_data refine_data.wave_tolerance = 1.0 refine_data.speed_tolerance = [1.0, 2.0, 3.0, 4.0] refine_data.variable_dt_refinement_ratios = True # == settopo.data values == topo_data = rundata.topo_data topo_data.topofiles = [] # for topography, append lines of the form # [topotype, fname] # See regions for control over these regions, need better bathy data for # the smaller domains clawutil.data.get_remote_file( "http://www.columbia.edu/~ktm2132/bathy/gulf_caribbean.tt3.tar.bz2") topo_path = os.path.join(scratch_dir, 'gulf_caribbean.tt3') topo_data.topofiles.append([3, topo_path]) # == setfixedgrids.data values == rundata.fixed_grid_data.fixedgrids = [] # for fixed grids append lines of the form # [t1,t2,noutput,x1,x2,y1,y2,xpoints,ypoints,\ # ioutarrivaltimes,ioutsurfacemax] # ================ # Set Surge Data # ================ data = rundata.surge_data # Source term controls - These are currently not respected data.wind_forcing = True data.drag_law = 1 data.pressure_forcing = True data.display_landfall_time = True # AMR parameters, m/s and m respectively data.wind_refine = [20.0, 40.0, 60.0] data.R_refine = [60.0e3, 40e3, 20e3] # Storm parameters - Parameterized storm (Holland 1980) data.storm_specification_type = 'holland80' # (type 1) data.storm_file = os.path.expandvars( os.path.join(os.getcwd(), 'isaac.storm')) # Convert ATCF data to GeoClaw format clawutil.data.get_remote_file( "http://ftp.nhc.noaa.gov/atcf/archive/2012/bal092012.dat.gz") atcf_path = os.path.join(scratch_dir, "bal092012.dat") # Note that the get_remote_file function does not support gzip files which # are not also tar files. The following code handles this with gzip.open(".".join((atcf_path, 'gz')), 'rb') as atcf_file, \ open(atcf_path, 'w') as atcf_unzipped_file: atcf_unzipped_file.write(atcf_file.read().decode('ascii')) # Uncomment/comment out to use the old version of the Ike storm file isaac = Storm(path=atcf_path, file_format="ATCF") # Calculate landfall time - Need to specify as the file above does not # include this info (~2345 UTC - 6:45 p.m. CDT - on August 28) isaac.time_offset = datetime.datetime(2012, 8, 29, 0) isaac.write(data.storm_file, file_format='geoclaw') # ======================= # Set Variable Friction # ======================= data = rundata.friction_data # Variable friction data.variable_friction = True # Region based friction # Entire domain data.friction_regions.append([ rundata.clawdata.lower, rundata.clawdata.upper, [np.infty, 0.0, -np.infty], [0.030, 0.022] ]) # La-Tex Shelf data.friction_regions.append([(-98, 25.25), (-90, 30), [np.infty, -10.0, -200.0, -np.infty], [0.030, 0.012, 0.022]]) return rundata
def setgeo(rundata): #------------------- """ Set GeoClaw specific runtime parameters. For documentation see .... """ try: geo_data = rundata.geo_data except: print("*** Error, this rundata has no geo_data attribute") raise AttributeError("Missing geo_data attribute") # == Physics == geo_data.gravity = 9.81 geo_data.coordinate_system = 1 geo_data.earth_radius = 6367.5e3 geo_data.rho = [1025.0 * 0.9, 1025.0] geo_data.rho_air = 1.15 geo_data.ambient_pressure = 101.3e3 # == Forcing Options geo_data.coriolis_forcing = True geo_data.theta_0 = 25.0 # Beta-plane approximation center geo_data.friction_forcing = True geo_data.friction_depth = 1e10 # == Algorithm and Initial Conditions == geo_data.sea_level = 0.0 geo_data.dry_tolerance = 1.e-2 # Refinement settings refine_data = rundata.refinement_data refine_data.wave_tolerance = 1.0 refine_data.speed_tolerance = [1.0, 2.0, 3.0, 4.0] refine_data.deep_depth = 300.0 refine_data.max_level_deep = 4 refine_data.variable_dt_refinement_ratios = True # == settopo.data values == topo_data = rundata.topo_data # for topography, append lines of the form # [topotype, minlevel, maxlevel, t1, t2, fname] topo_data.topofiles.append([2, 1, 5, -RAMP_UP_TIME, 1e10, 'topo.tt2']) # == setdtopo.data values == dtopo_data = rundata.dtopo_data # for moving topography, append lines of the form : (<= 1 allowed for now!) # [topotype, minlevel,maxlevel,fname] # ================ # Set Surge Data # ================ data = rundata.surge_data # Source term controls data.wind_forcing = True data.drag_law = 1 data.pressure_forcing = True data.wind_index = 2 data.pressure_index = 4 data.display_landfall_time = True # AMR parameters, m/s and m respectively data.wind_refine = [20.0, 40.0, 60.0] data.R_refine = [60.0e3, 40e3, 20e3] # Storm parameters - Parameterized storm (Holland 1980) data.storm_specification_type = 'holland80' # (type 1) data.storm_file = os.path.expandvars( os.path.join(os.getcwd(), 'fake.storm')) # Contruct storm forward_velocity = units.convert(20, 'km/h', 'm/s') theta = 0.0 * numpy.pi / 180.0 # degrees from horizontal to radians my_storm = Storm() # Take seconds and time period of 30 minutes and turn them into datatimes t_ref = datetime.datetime.now() t_sec = numpy.arange(-RAMP_UP_TIME, rundata.clawdata.tfinal, 30.0 * 60.0) my_storm.t = [t_ref + datetime.timedelta(seconds=t) for t in t_sec] ramp_func = lambda t: (t + (2 * RAMP_UP_TIME)) * (t < 0) / (2 * RAMP_UP_TIME) \ + numpy.ones(t_sec.shape) * (t >= 0) my_storm.time_offset = t_ref my_storm.eye_location = numpy.empty((t_sec.shape[0], 2)) my_storm.eye_location[:, 0] = forward_velocity * t_sec * numpy.cos(theta) my_storm.eye_location[:, 1] = forward_velocity * t_sec * numpy.sin(theta) my_storm.max_wind_speed = units.convert(56, 'knots', 'm/s') * ramp_func(t_sec) my_storm.central_pressure = units.convert(1024, "mbar", "Pa") \ - (units.convert(1024, "mbar", "Pa") \ - units.convert(950, 'mbar', 'Pa')) \ * ramp_func(t_sec) my_storm.max_wind_radius = [units.convert(8, 'km', 'm')] * t_sec.shape[0] my_storm.storm_radius = [units.convert(100, 'km', 'm')] * t_sec.shape[0] my_storm.write(data.storm_file, file_format="geoclaw") # ====================== # Multi-layer settings # ====================== data = rundata.multilayer_data # Physics parameters data.num_layers = 2 data.eta = [0.0, -300.0] # Algorithm parameters data.eigen_method = 2 data.inundation_method = 2 data.richardson_tolerance = 1e10 data.wave_tolerance = [0.1, 0.5] data.layer_index = 1 # ======================= # Set Variable Friction # ======================= data = rundata.friction_data # Variable friction data.variable_friction = False data.friction_index = 1 return rundata
def setgeo(rundata): """ Set GeoClaw specific runtime parameters. For documentation see .... """ geo_data = rundata.geo_data # == Physics == geo_data.gravity = 9.81 geo_data.coordinate_system = 2 geo_data.earth_radius = 6367.5e3 geo_data.rho = 1025.0 geo_data.rho_air = 1.15 geo_data.ambient_pressure = 101.3e3 # == Forcing Options geo_data.coriolis_forcing = True geo_data.friction_forcing = True geo_data.friction_depth = 1e10 # == Algorithm and Initial Conditions == # Due to seasonal swelling of gulf we set sea level higher geo_data.sea_level = 0.28 geo_data.dry_tolerance = 1.e-2 # Refinement Criteria refine_data = rundata.refinement_data refine_data.wave_tolerance = 1.0 refine_data.speed_tolerance = [1.0, 2.0, 3.0, 4.0] refine_data.deep_depth = 300.0 refine_data.max_level_deep = 4 refine_data.variable_dt_refinement_ratios = True # == settopo.data values == topo_data = rundata.topo_data topo_data.topofiles = [] # for topography, append lines of the form # [topotype, minlevel, maxlevel, t1, t2, fname] # See regions for control over these regions, need better bathy data for # the smaller domains clawutil.data.get_remote_file( "http://www.columbia.edu/~ktm2132/bathy/gulf_caribbean.tt3.tar.bz2") topo_path = os.path.join(scratch_dir, 'gulf_caribbean.tt3') topo_data.topofiles.append([3, 1, 5, rundata.clawdata.t0, rundata.clawdata.tfinal, topo_path]) # == setfixedgrids.data values == rundata.fixed_grid_data.fixedgrids = [] # for fixed grids append lines of the form # [t1,t2,noutput,x1,x2,y1,y2,xpoints,ypoints,\ # ioutarrivaltimes,ioutsurfacemax] # ================ # Set Surge Data # ================ data = rundata.surge_data # Source term controls data.wind_forcing = True data.drag_law = 1 data.pressure_forcing = True data.display_landfall_time = True # AMR parameters, m/s and m respectively data.wind_refine = [20.0, 40.0, 60.0] data.R_refine = [60.0e3, 40e3, 20e3] # Storm parameters - Parameterized storm (Holland 1980) data.storm_specification_type = 'holland80' # (type 1) data.storm_file = os.path.expandvars(os.path.join(os.getcwd(), 'ike.storm')) # Convert ATCF data to GeoClaw format clawutil.data.get_remote_file( "http://ftp.nhc.noaa.gov/atcf/archive/2008/bal092008.dat.gz") atcf_path = os.path.join(scratch_dir, "bal092008.dat") # Note that the get_remote_file function does not support gzip files which # are not also tar files. The following code handles this with gzip.open(".".join((atcf_path, 'gz')), 'rb') as atcf_file, \ open(atcf_path, 'w') as atcf_unzipped_file: atcf_unzipped_file.write(atcf_file.read().decode('ascii')) # Uncomment/comment out to use the old version of the Ike storm file # ike = Storm(path="old_ike.storm", file_format="ATCF") ike = Storm(path=atcf_path, file_format="ATCF") # Calculate landfall time - Need to specify as the file above does not # include this info (9/13/2008 ~ 7 UTC) ike.time_offset = datetime.datetime(2008, 9, 13, 7) ike.write(data.storm_file, file_format='geoclaw') # ======================= # Set Variable Friction # ======================= data = rundata.friction_data # Variable friction data.variable_friction = True # Region based friction # Entire domain data.friction_regions.append([rundata.clawdata.lower, rundata.clawdata.upper, [np.infty, 0.0, -np.infty], [0.030, 0.022]]) # La-Tex Shelf data.friction_regions.append([(-98, 25.25), (-90, 30), [np.infty, -10.0, -200.0, -np.infty], [0.030, 0.012, 0.022]]) return rundata
def setgeo(rundata): """ Set GeoClaw specific runtime parameters. For documentation see .... """ geo_data = rundata.geo_data # == Physics == geo_data.gravity = 9.81 geo_data.coordinate_system = 2 geo_data.earth_radius = 6367.5e3 geo_data.rho = 1025.0 geo_data.rho_air = 1.15 geo_data.ambient_pressure = 101.3e3 # == Forcing Options geo_data.coriolis_forcing = True geo_data.friction_forcing = True geo_data.friction_depth = 1e10 # == Algorithm and Initial Conditions == # Due to seasonal swelling of gulf we set sea level higher geo_data.sea_level = 0.0 geo_data.dry_tolerance = 1.e-2 # Refinement Criteria refine_data = rundata.refinement_data refine_data.wave_tolerance = 1.0 refine_data.speed_tolerance = [1.0, 2.0, 3.0, 4.0] refine_data.deep_depth = 300.0 refine_data.max_level_deep = 4 refine_data.variable_dt_refinement_ratios = True # == settopo.data values == topo_data = rundata.topo_data topo_data.topofiles = [] topo_data.topofiles.append([3, 1, 3, rundata.clawdata.t0, rundata.clawdata.tfinal, '../bathy/atlantic_2min.tt3']) topo_data.topofiles.append([3, 1, 5, rundata.clawdata.t0, rundata.clawdata.tfinal, '../bathy/newyork_3s.tt3']) # == setqinit.data values == rundata.qinit_data.qinit_type = 0 # == setfixedgrids.data values == rundata.fixed_grid_data.fixedgrids = [] # for fixed grids append lines of the form # [t1,t2,noutput,x1,x2,y1,y2,xpoints,ypoints,\ # ioutarrivaltimes,ioutsurfacemax] # ================ # Set Surge Data # ================ data = rundata.surge_data # Source term controls - These are currently not respected data.wind_forcing = True data.drag_law = 1 data.pressure_forcing = True data.display_landfall_time = True # AMR parameters, m/s and m respectively data.wind_refine = [20.0, 40.0, 60.0] data.R_refine = [60.0e3, 40e3, 20e3] # Storm parameters - Parameterized storm (Holland 1980) data.storm_specification_type = 'holland80' data.storm_file = os.path.expandvars(os.path.join(os.getcwd(), 'sandy.storm')) # Convert ATCF data to GeoClaw format clawutil.data.get_remote_file( "http://ftp.nhc.noaa.gov/atcf/archive/2012/bal182012.dat.gz") atcf_path = os.path.join(scratch_dir, "bal182012.dat") # Note that the get_remote_file function does not support gzip files which # are not also tar files. The following code handles this with gzip.open(".".join((atcf_path, 'gz')), 'rb') as atcf_file, \ open(atcf_path, 'w') as atcf_unzipped_file: atcf_unzipped_file.write(atcf_file.read().decode('ascii')) sandy = Storm(path=atcf_path, file_format="ATCF", single_storm=True) # Calculate landfall time - Need to specify as the file above does not sandy.time_offset = datetime.datetime(2012, 10, 29, 8, 0) sandy.write(data.storm_file, file_format='geoclaw') # ======================= # Set Variable Friction # ======================= data = rundata.friction_data # Variable friction data.variable_friction = True # Region based friction # Entire domain data.friction_regions.append([rundata.clawdata.lower, rundata.clawdata.upper, [np.infty, 0.0, -np.infty], [0.050, 0.025]]) return rundata
def run_storm_job(first_storm=0, last_storm=0, wind_model='holland80', amr_level=2): r""" Setup jobs to run at specific storm start and end. """ # Path to file containing log of storms run path = os.path.join(os.environ.get('DATA_PATH', os.getcwd()), "square_basin", "square-basin-storm-%i-%i" % (first_storm, last_storm), "run_log.txt") if not os.path.exists(path): os.makedirs(os.path.dirname(path)) # File to tracy synthetic storm in atcf format tracy_atcf_path = 'data/tracy_synthetic_atcf.storm' # Establish a control form of tracy control = Storm(path=tracy_atcf_path, file_format='ATCF') control.read_atcf(path=tracy_atcf_path) # Change tracy to piece wise constant wind curve u0 = control.max_wind_speed[1] control.max_wind_speed = piecewise_wind_curve(u0, control.max_wind_speed) control.write("data/tracy_geoclaw.storm", file_format="geoclaw") # Get a general storm path #data_path = os.path.join(os.getcwd(), "../../../data") #storms_path = os.path.join(data_path, "storms") #tracks = os.path.join(storms_path, "geoclaw-mumbai-tracks") tracks = os.path.join(os.getcwd(), "data", "synthetic_storm_files") num_storms = 1000 #storm_gauges = [(72.811790, 18.936508), (72.972316, 18.997762), # (72.819311, 18.818044)] #regions_data = [] #regions_data.append([2, 5, 70, 75, 17, 22]) ## Mumbai #regions_data.append([4, 7, 72.6, 73, 18.80, 19.15]) storm_gauges = None regions_data = None num_storms = 1000 with open(path, 'w') as run_log_file: jobs = [] for n in range(0, num_storms): storm = copy.copy(control) mws = copy.copy(control.max_wind_speed) mws = perturb_wind(mws) C0 = 218.3784 * numpy.ones(len(mws)) mwr = C0 - 1.2014 * mws + (mws / 10.9884)**2 - ( mws / 35.3052)**3 - 145.5090 * numpy.cos( control.eye_location[:, 1] * 0.0174533) storm.max_wind_speed = mws #storm.max_wind_radius = mwr # Name storm file and write to log storm_name = 'SquareBasin_%s.storm' % str(n) run_log_file.write("%s %s\n" % (n, '%s' % storm_name)) # Add job to queue jobs.append( StormJob(run_number=n, storm_directory=tracks, storm_object=storm, wind_model=wind_model, amr_level=amr_level, storm_ensemble_type="Synthetic", region="SquareBasin", gauges=storm_gauges, regions=regions_data)) #num_storms = 1 if n == num_storms - 1: #controller = StormHabaneroBatchController(jobs) controller = batch.HabaneroBatchController(jobs) controller.email = '*****@*****.**' print(controller) controller.run() jobs = [] break return jobs
def setgeo(rundata): """ Set GeoClaw specific runtime parameters. For documentation see .... """ geo_data = rundata.geo_data # == Physics == geo_data.gravity = 9.81 geo_data.coordinate_system = 2 geo_data.earth_radius = 6367.5e3 geo_data.rho = 1025.0 geo_data.rho_air = 1.15 geo_data.ambient_pressure = 101.3e3 # == Forcing Options geo_data.coriolis_forcing = True geo_data.friction_forcing = True geo_data.friction_depth = 1e10 # == Algorithm and Initial Conditions == # Due to seasonal swelling of gulf we set sea level higher geo_data.sea_level = 0 geo_data.dry_tolerance = 1.e-2 # Refinement Criteria refine_data = rundata.refinement_data refine_data.wave_tolerance = 1.0 refine_data.speed_tolerance = [1.0, 2.0, 3.0, 4.0] refine_data.deep_depth = 300.0 refine_data.max_level_deep = 4 refine_data.variable_dt_refinement_ratios = True # == settopo.data values == topo_data = rundata.topo_data topo_data.topofiles = [] topo_data.topo_missing = -32768 # for topography, append lines of the form # [topotype, minlevel, maxlevel, t1, t2, fname] # See regions for control over these regions, need better bathy data for # the smaller domains # Entire domain minlon = rundata.clawdata.lower[0] maxlon = rundata.clawdata.upper[0] minlat = rundata.clawdata.lower[1] maxlat = rundata.clawdata.upper[1] # ERDDAP Data Access Form call # ETOPO - 1 arcminute resolution topo_filename = f'etopo180.esriAscii?altitude[({minlat}):1:({maxlat})][({minlon}):1:({maxlon})]' topo_url = 'http://coastwatch.pfeg.noaa.gov/erddap/griddap/' + topo_filename clawutil.data.get_remote_file(topo_url) topo_path = os.path.join(scratch_dir, topo_filename) topo_data.topofiles.append( [3, 1, 5, rundata.clawdata.t0, rundata.clawdata.tfinal, topo_path]) # Caribbean region # minlat = 9 # maxlat = 28 # minlon = -86 # maxlon = -58 # Break up into two regions # Caribbean region (NW) minlat = 16 maxlat = 28 minlon = -86 maxlon = -68 # ERDDAP Data Access Form call # SRTM15 - 15 arcsecond resolution # topo_filename = f'srtm15plus.esriAscii?z[({minlat}):1:({maxlat})][({minlon}):1:({maxlon})]' # GEBCO_2020 Grid - 15 arcsecond resolution topo_filename = f'GEBCO_2020.esriAscii?elevation[({minlat}):1:({maxlat})][({minlon}):1:({maxlon})]' topo_url = 'http://coastwatch.pfeg.noaa.gov/erddap/griddap/' + topo_filename clawutil.data.get_remote_file(topo_url) topo_path = os.path.join(scratch_dir, topo_filename) topo_data.topofiles.append([ 3, 1, rundata.amrdata.amr_levels_max, rundata.clawdata.t0, rundata.clawdata.tfinal, topo_path ]) # Caribbean region (SE) minlat = 9 maxlat = 21 minlon = -69 maxlon = -58 # ERDDAP Data Access Form call # SRTM15 - 15 arcsecond resolution # topo_filename = f'srtm15plus.esriAscii?z[({minlat}):1:({maxlat})][({minlon}):1:({maxlon})]' # GEBCO_2020 Grid - 15 arcsecond resolution topo_filename = f'GEBCO_2020.esriAscii?elevation[({minlat}):1:({maxlat})][({minlon}):1:({maxlon})]' topo_url = 'http://coastwatch.pfeg.noaa.gov/erddap/griddap/' + topo_filename clawutil.data.get_remote_file(topo_url) topo_path = os.path.join(scratch_dir, topo_filename) topo_data.topofiles.append([ 3, 1, rundata.amrdata.amr_levels_max, rundata.clawdata.t0, rundata.clawdata.tfinal, topo_path ]) # Virgin Islands High resolution # # High resolution (1 arcsec / 30m) Virgin Islands topo-bathy (roughly 2^-11 deg) # VI_highres_filename = 'usvi_1_mhw_2014.nc' # VI_highres_url = 'https://www.ngdc.noaa.gov/thredds/ncss/regional/' + VI_highres_filename # clawutil.data.get_remote_file(VI_highres_url) # # Note: for faster performance, crop this file to 17.5N to 18.5N x -65.1W to -64.3W # # gdal_translate -projwin -65.1 18.5 -64.3 17.5 usvi_1_mhw_2014.nc usvi_1_mhw_2014_crop.nc # # Note 2: for even faster performance, subsample to 60m resolution: # # gdalwarp -tr 0.00056 0.00056 -r cubic usvi_1_mhw_2014_crop.nc usvi_1_mhw_2014_crop_subsample.nc # # Then update the filename: # # VI_highres_filename = 'usvi_1_mhw_2014_crop_subsample.nc' # topo_path = os.path.join(scratch_dir, VI_highres_filename) # topo_data.topofiles.append([4, 1, 7, rundata.clawdata.t0, # rundata.clawdata.tfinal, # topo_path]) # == setfixedgrids.data values == rundata.fixed_grid_data.fixedgrids = [] # for fixed grids append lines of the form # [t1,t2,noutput,x1,x2,y1,y2,xpoints,ypoints,\ # ioutarrivaltimes,ioutsurfacemax] # ================ # Set Surge Data # ================ data = rundata.surge_data # Source term controls data.wind_forcing = True data.drag_law = 1 data.pressure_forcing = True data.display_landfall_time = True # AMR parameters, m/s and m respectively data.wind_refine = [20.0, 40.0, 60.0] data.R_refine = [60e3, 40e3, 20e3] # Storm parameters - Parameterized storm (Holland 1980) data.storm_specification_type = 'holland80' # (type 1) data.storm_file = os.path.expandvars( os.path.join(os.getcwd(), 'tomas.storm')) # Convert ATCF data to GeoClaw format clawutil.data.get_remote_file( "http://ftp.nhc.noaa.gov/atcf/archive/2010/bal212010.dat.gz") atcf_path = os.path.join(scratch_dir, "bal212010.dat") # Note that the get_remote_file function does not support gzip files which # are not also tar files. The following code handles this with gzip.open(".".join((atcf_path, 'gz')), 'rb') as atcf_file, \ open(atcf_path, 'w') as atcf_unzipped_file: atcf_unzipped_file.write(atcf_file.read().decode('ascii')) storm = Storm(path=atcf_path, file_format="ATCF") # Calculate landfall time - Need to specify as the file above does not #ike.time_offset = datetime.datetime(YYYY, MM, DD, HH in UTC) # "Landfall" for Irma at Virgin Islands was Sept 6, at ~ 18:00 UTC (2pm EST) # storm.time_offset = datetime.datetime(1979, 9, 6, 18) # Tomas developed from a tropical wave east of the Windward Islands on October 29 # Data starts at 2010-10-29-06 storm.time_offset = datetime.datetime(2010, 10, 30, 6) storm.write(data.storm_file, file_format='geoclaw') # ======================= # Set Variable Friction # ======================= data = rundata.friction_data # Variable friction data.variable_friction = True # Region based friction # Entire domain data.friction_regions.append([ rundata.clawdata.lower, rundata.clawdata.upper, [np.infty, 0.0, -np.infty], [0.030, 0.022] ]) return rundata
def setgeo(rundata): """ Set GeoClaw specific runtime parameters. For documentation see .... """ geo_data = rundata.geo_data # == Physics == geo_data.gravity = 9.81 geo_data.coordinate_system = 2 geo_data.earth_radius = 6367.5e3 geo_data.rho = 1025.0 geo_data.rho_air = 1.15 geo_data.ambient_pressure = 101.3e3 # == Forcing Options geo_data.coriolis_forcing = True geo_data.friction_forcing = True geo_data.friction_depth = 1e10 # == Algorithm and Initial Conditions == # Due to seasonal swelling of gulf we set sea level higher geo_data.sea_level = 0.28 geo_data.dry_tolerance = 1.e-2 # Refinement Criteria refine_data = rundata.refinement_data refine_data.wave_tolerance = 1.0 refine_data.speed_tolerance = [1.0, 2.0, 3.0, 4.0] refine_data.deep_depth = 300.0 refine_data.max_level_deep = 4 refine_data.variable_dt_refinement_ratios = True # == settopo.data values == topo_data = rundata.topo_data topo_data.topofiles = [] # for topography, append lines of the form # [topotype, minlevel, maxlevel, t1, t2, fname] # See regions for control over these regions, need better bathy data for # the smaller domains clawutil.data.get_remote_file( "http://www.columbia.edu/~ktm2132/bathy/gulf_caribbean.tt3.tar.bz2") topo_path = os.path.join(scratch_dir, 'gulf_caribbean.tt3') topo_data.topofiles.append( [3, 1, 5, rundata.clawdata.t0, rundata.clawdata.tfinal, topo_path]) topo = topotools.Topography() topo.read(topo_path, topo_type=2) # Create the Flag Region data file filter_region = (-100, -92, 25, 30) topotex = topo.crop(filter_region) pts_chosen = marching_front.select_by_flooding(topotex.Z, Z1=0, Z2=15., max_iters=None) Zmasked = ma.masked_array(topotex.Z, np.logical_not(pts_chosen)) pts_chosen = marching_front.select_by_flooding(topotex.Z, Z1=0, Z2=1e6, max_iters=20) Zmasked = ma.masked_array(topotex.Z, np.logical_not(pts_chosen)) pts_chosen = marching_front.select_by_flooding(topotex.Z, Z1=0, Z2=15., prev_pts_chosen=pts_chosen, max_iters=None) Zmasked = ma.masked_array(topotex.Z, np.logical_not(pts_chosen)) pts_chosen_shallow = marching_front.select_by_flooding(topotex.Z, Z1=0, Z2=-15., max_iters=None) Zshallow = ma.masked_array(topotex.Z, np.logical_not(pts_chosen_shallow)) pts_chosen_nearshore = np.logical_and(pts_chosen, pts_chosen_shallow) Znearshore = ma.masked_array(topotex.Z, np.logical_not(pts_chosen_nearshore)) fname_fgmax_mask = 'fgmax_pts_topostyle.data' topo_fgmax_mask = topotools.Topography() topo_fgmax_mask._x = topotex.x topo_fgmax_mask._y = topotex.y topo_fgmax_mask._Z = np.where(pts_chosen_nearshore, 1, 0) # change boolean to 1/0 topo_fgmax_mask.generate_2d_coordinates() topo_fgmax_mask.write(fname_fgmax_mask, topo_type=3, Z_format='%1i') rr = region_tools.ruledrectangle_covering_selected_points( topotex.X, topotex.Y, pts_chosen_nearshore, ixy='y', method=0, padding=0, verbose=True) xv, yv = rr.vertices() rr.write('texcoastrr.data') # == setfixedgrids.data values == rundata.fixed_grid_data.fixedgrids = [] # for fixed grids append lines of the form # [t1,t2,noutput,x1,x2,y1,y2,xpoints,ypoints,\ # ioutarrivaltimes,ioutsurfacemax] # ================ # Set Surge Data # ================ data = rundata.surge_data # Source term controls data.wind_forcing = True data.drag_law = 1 data.pressure_forcing = True data.display_landfall_time = True # AMR parameters, m/s and m respectively data.wind_refine = [20.0, 40.0, 60.0] data.R_refine = [60.0e3, 40e3, 20e3] # Storm parameters - Parameterized storm (Holland 1980) data.storm_specification_type = 'holland80' # (type 1) data.storm_file = os.path.expandvars( os.path.join(os.getcwd(), 'harvey.storm')) # Convert ATCF data to GeoClaw format clawutil.data.get_remote_file( "http://ftp.nhc.noaa.gov/atcf/archive/2017/bal092017.dat.gz") atcf_path = os.path.join(scratch_dir, "bal092017.dat") # Note that the get_remote_file function does not support gzip files which # are not also tar files. The following code handles this with gzip.open(".".join((atcf_path, 'gz')), 'rb') as atcf_file, \ open(atcf_path, 'w') as atcf_unzipped_file: atcf_unzipped_file.write(atcf_file.read().decode('ascii')) # Uncomment/comment out to use the old version of the Ike storm file # ike = Storm(path="old_ike.storm", file_format="ATCF") harvey = Storm(path=atcf_path, file_format="ATCF") # Calculate landfall time - Need to specify as the file above does not # include this info (9/13/2008 ~ 7 UTC) harvey.time_offset = datetime.datetime(2017, 8, 25, 10) harvey.write(data.storm_file, file_format='geoclaw') # ======================= # Set Variable Friction # ======================= data = rundata.friction_data # Variable friction data.variable_friction = True # Region based friction # Entire domain data.friction_regions.append([ rundata.clawdata.lower, rundata.clawdata.upper, [np.infty, 0.0, -np.infty], [0.030, 0.022] ]) # Texas gulf coast data.friction_regions.append([(-99.2, 26.4), (-94.2, 30.4), [np.infty, -10.0, -200.0, -np.infty], [0.030, 0.012, 0.022]]) return rundata
def setgeo(rundata): """ Set GeoClaw specific runtime parameters. For documentation see .... """ geo_data = rundata.geo_data # == Physics == geo_data.gravity = 9.81 geo_data.coordinate_system = 2 geo_data.earth_radius = 6367.5e3 geo_data.rho = 1025.0 geo_data.rho_air = 1.15 geo_data.ambient_pressure = 101.3e3 # == Forcing Options geo_data.coriolis_forcing = True geo_data.friction_forcing = True geo_data.manning_coefficient = 0.025 # Overridden below geo_data.friction_depth = 1e6 # == Algorithm and Initial Conditions == # Due to seasonal swelling of gulf we set sea level higher geo_data.sea_level = 0.0 geo_data.dry_tolerance = 1.e-2 # Refinement Criteria refine_data = rundata.refinement_data refine_data.wave_tolerance = 5e-1 refine_data.speed_tolerance = [0.25,0.5,1.0,2.0,3.0,4.0] refine_data.deep_depth = 2e2 refine_data.max_level_deep = 4 refine_data.variable_dt_refinement_ratios = True # == settopo.data values == topo_data = rundata.topo_data topo_data.test_topography = 2 topo_data.topofiles = [] # Based on approximately 100 km = 1 degree of long # Based on approximately 110 km = 1 degree of lat # geodata.x0 = rundata.clawdata.lower[0] + 3.5 # geodata.x1 = rundata.clawdata.lower[0] + 4.5 # geodata.x2 = rundata.clawdata.lower[0] + 4.8 topo_data.x0 = rundata.clawdata.lower[0] + 10 topo_data.x1 = rundata.clawdata.lower[0] + 10.65 topo_data.x2 = rundata.clawdata.lower[0] + 10.85 topo_data.basin_depth = -3000.0 # geodata.basin_depth = -100.0 topo_data.shelf_depth = -200.0 beach_height = 300.0 topo_data.beach_slope = -(beach_height + topo_data.shelf_depth) / (rundata.clawdata.upper[0] - topo_data.x2) #topo_data.beach_slope = 0.05 # == setqinit.data values == rundata.qinit_data.qinit_type = 0 # == setfixedgrids.data values == rundata.fixed_grid_data.fixedgrids = [] # for fixed grids append lines of the form # [t1,t2,noutput,x1,x2,y1,y2,xpoints,ypoints,\ # ioutarrivaltimes,ioutsurfacemax] # ================ # Set Surge Data # ================ data = rundata.surge_data # Source term controls data.wind_forcing = True data.drag_law = 2 data.pressure_forcing = True data.display_landfall_time = True # AMR parameters, m/s and m respectively data.wind_refine = [20.0, 40.0, 60.0] data.R_refine = [60.0e3, 40e3, 20e3] # Storm parameters - Parameterized storm (Holland 1980) data.storm_specification_type = 'holland80' # (type 1) data.storm_file = os.path.expandvars(os.path.join(os.getcwd(), 'tracy.storm')) # Convert ATCF data to GeoClaw format #clawutil.data.get_remote_file( # "http://ftp.nhc.noaa.gov/atcf/archive/2008/bal092008.dat.gz") #atcf_path = os.path.join(scratch_dir, "bal092008.dat") #atcf_path = os.path.join(os.getcwd(), 'tracy_atcf.storm') atcf_path = os.path.join(os.getcwd(), 'tracy_atcf_mwrx2.storm') ## Note that the get_remote_file function does not support gzip files which ## are not also tar files. The following code handles this #with gzip.open(".".join((atcf_path, 'gz')), 'rb') as atcf_file, \ # open(atcf_path, 'w') as atcf_unzipped_file: # atcf_unzipped_file.write(atcf_file.read().decode('ascii')) # Uncomment/comment out to use the old version of the Ike storm file tracy = Storm(path=atcf_path, file_format="ATCF") # Calculate landfall time - Need to specify as the file above does not # include this info (9/13/2008 ~ 7 UTC) tracy.time_offset = datetime.datetime(2008, 8, 1, 12) tracy.write(data.storm_file, file_format='geoclaw') ## Storm parameters, not written out but used to write the tracy.data file #data.ramp_up_t = days2seconds(RAMP_UP_TIME) ## Convert from 5.0 m/s to degrees/s at lat 25N #data.velocity = [4.9603e-05, 0.0] ## Assume domain (-90, 20) to (-85, 25) (W and N respectively) #data.R_eye_init = [-89, 22.5] #data.A = 23.0 #data.B = 1.5 #data.Pc = 950.0 * 1e2 # Have to convert this to Pa instead of millibars # ======================= # Set Variable Friction # ======================= data = rundata.friction_data # Variable friction data.variable_friction = True # Region based friction # Entire domain data.friction_regions.append([rundata.clawdata.lower, rundata.clawdata.upper, [np.infty,0.0,-np.infty], [0.030, 0.022]]) return rundata
def setgeo(rundata): """ Set GeoClaw specific runtime parameters. For documentation see .... """ geo_data = rundata.geo_data # == Physics == geo_data.gravity = 9.81 geo_data.coordinate_system = 2 geo_data.earth_radius = 6367.5e3 geo_data.rho = 1025.0 geo_data.rho_air = 1.15 geo_data.ambient_pressure = 101.3e3 # == Forcing Options geo_data.coriolis_forcing = True geo_data.friction_forcing = True geo_data.friction_depth = 1e10 # == Algorithm and Initial Conditions == # Due to seasonal swelling of gulf we set sea level higher geo_data.sea_level = 0.0 geo_data.dry_tolerance = 1.e-2 # Refinement Criteria refine_data = rundata.refinement_data refine_data.wave_tolerance = 1.0 refine_data.speed_tolerance = [1.0, 2.0, 3.0, 4.0] refine_data.deep_depth = 300.0 refine_data.max_level_deep = 4 refine_data.variable_dt_refinement_ratios = True # == settopo.data values == topo_data = rundata.topo_data topo_data.topofiles = [] # for topography, append lines of the form:[topotype, minlevel, maxlevel, t1, t2, fname] # See regions for control over these regions, need better bathy data for the smaller domains # !!!!!!!!!!!!!!!!NEED TO MODIFY PATH HERE IF TESTING EXAMPLE!!!!!!!!!!!!! topo_path = os.path.join( "/home/socoyjonathan/clawpack_src/clawpack-v5.7.1/geoclaw/topograpy", "topography.asc") topo_data.topofiles.append( [3, 1, 5, rundata.clawdata.t0, rundata.clawdata.tfinal, topo_path]) # == setfixedgrids.data values == rundata.fixed_grid_data.fixedgrids = [] # for fixed grids append lines of the form # [t1,t2,noutput,x1,x2,y1,y2,xpoints,ypoints,ioutarrivaltimes,ioutsurfacemax] # ================ # Set Surge Data # ================ data = rundata.surge_data # Source term controls data.wind_forcing = True data.drag_law = 1 data.pressure_forcing = True data.display_landfall_time = True # AMR parameters, m/s and m respectively data.wind_refine = [20.0, 40.0, 60.0] data.R_refine = [60.0e3, 40e3, 20e3] # Storm parameters - Parameterized storm (Holland 1980) data.storm_specification_type = 'holland80' # (type 1) data.storm_file = os.path.expandvars( os.path.join(os.getcwd(), 'ophelia.storm')) # Convert ATCF data to GeoClaw format clawutil.data.get_remote_file( "https://ftp.nhc.noaa.gov/atcf/archive/2017/bal172017.dat.gz") atcf_path = os.path.join(scratch_dir, "bal172017.dat") # Note that the get_remote_file function does not support gzip files which # are not also tar files. The following code handles this with gzip.open(".".join((atcf_path, 'gz')), 'rb') as atcf_file, open(atcf_path, 'w') as atcf_unzipped_file: atcf_unzipped_file.write(atcf_file.read().decode('ascii')) # ophelia = Storm(path="old_ophelia.storm", file_format="ATCF") ophelia = Storm(path=atcf_path, file_format="ATCF") # Calculate landfall time - Need to specify as the file above does not # Ophelia landfall: 10/16/2017 ~ 1100 UTC ophelia.time_offset = datetime.datetime(2017, 10, 16, 11) ophelia.write(data.storm_file, file_format='geoclaw') # ======================= # Set Variable Friction # ======================= data = rundata.friction_data # Variable friction data.variable_friction = True # Region based friction # Entire domain data.friction_regions.append([ rundata.clawdata.lower, rundata.clawdata.upper, [np.infty, 0.0, -np.infty], [0.030, 0.022] ]) # UK data.friction_regions.append([(-10.5, 51.5), (0, 60), [np.infty, -10.0, -200.0, -np.infty], [0.030, 0.012, 0.022]]) return rundata