예제 #1
0
파일: setup.py 프로젝트: serc/wave
def patch_wind_into_flow(sim_dir, params):
    import h5py
    from wavecon import CMSman
    from numpy import array, transpose
    from os import path
    # Hack-o-saurus rex strikes again!
    times = CMSman.maketimes(params['sim_starttime'],
        params['sim_runtime'], params['sim_timestep'], return_timestamps=False)

    windfile = path.join(sim_dir, params['sim_name'] + '.wind.ave')
    windfile = open(windfile, 'r')
    windat = windfile.read().splitlines()
    windfile.close()
    speed, direc = zip(*[(float(speed), float(direc)) for speed, direc in [line.split() for
        line in windat]])

    speed = transpose(array(speed,ndmin=2))
    direc = transpose(array(direc,ndmin=2))
    times = transpose(array(times,ndmin=2))

    
    flow_params = h5py.File(path.join(sim_dir,params['sim_name'] + '_mp.h5'), 'a')
    del flow_params['PROPERTIES/Model Params/WindCurve/Magnitude']
    flow_params.create_dataset('PROPERTIES/Model Params/WindCurve/Magnitude', data = speed)
    del flow_params['PROPERTIES/Model Params/WindCurve/Direction']
    flow_params.create_dataset('PROPERTIES/Model Params/WindCurve/Direction', data = direc)
    del flow_params['PROPERTIES/Model Params/WindCurve/Times']
    flow_params.create_dataset('PROPERTIES/Model Params/WindCurve/Times', data = times)
    flow_params.close()

    return None
예제 #2
0
def makeWaveInput():

    #DEFINE SPATIAL/TEMPORAL DOMAIN
    box = CMSman.makebox()
    steeringtimes = CMSman.maketimes(None, None, None)

    #RETRIEVE WAVE DATA FROM DATABASE
    wavdata = CMSman.getwavedata(box, steeringtimes)  #add wavtype
    if (wavdata == None):
        print '\n... downloading new wave data ... \n'
        GETman.getWAVE(CMSconfig)
        wavdata = CMSman.getwavedata(box, steeringtimes)  #add wavtype

    # CONSTRUCT THE FILE
    CMSman.gen_wavefiles(wavdata, steeringtimes)
예제 #3
0
def makeWindInput():

    #DEFINE SPATIAL/TEMPORAL DOMAIN
    grid = CMSman.makegrid()
    steeringtimes = CMSman.maketimes(None, None, None)

    #RETRIEVE WIND DATA FROM DATABASE
    windata = CMSman.getwinddata(None, steeringtimes)  #add wintype
    if (windata == None):
        print '\n... downloading new wind data ... \n'
        GETman.getWIND(CMSconfig)
        windata = CMSman.getwinddata(None, steeringtimes)  #add wintype

    # CONSTRUCT THE FILE
    CMSman.gen_windfiles(windata, grid, steeringtimes)
예제 #4
0
파일: prepareCMS.py 프로젝트: serc/wave
def makeWaveInput():
    
    #DEFINE SPATIAL/TEMPORAL DOMAIN
    box = CMSman.makebox()
    steeringtimes = CMSman.maketimes(None,None,None)

    #RETRIEVE WAVE DATA FROM DATABASE
    wavdata = CMSman.getwavedata(box,steeringtimes) #add wavtype
    if (wavdata==None):
      print '\n... downloading new wave data ... \n'
      GETman.getWAVE(CMSconfig)
      wavdata = CMSman.getwavedata(box,steeringtimes) #add wavtype 
    
    # CONSTRUCT THE FILE
    CMSman.gen_wavefiles(wavdata,steeringtimes)
예제 #5
0
파일: prepareCMS.py 프로젝트: serc/wave
def makeWindInput():
  
  #DEFINE SPATIAL/TEMPORAL DOMAIN
  grid = CMSman.makegrid()
  steeringtimes = CMSman.maketimes(None,None,None)  
  
  #RETRIEVE WIND DATA FROM DATABASE
  windata = CMSman.getwinddata(None,steeringtimes) #add wintype
  if (windata==None):
    print '\n... downloading new wind data ... \n'
    GETman.getWIND(CMSconfig)
    windata = CMSman.getwinddata(None,steeringtimes) #add wintype
  
  # CONSTRUCT THE FILE
  CMSman.gen_windfiles(windata,grid,steeringtimes)
예제 #6
0
파일: setup.py 프로젝트: Mads-J/wave
def patch_wind_into_flow(sim_dir, params):
    import h5py
    from wavecon import CMSman
    from numpy import array, transpose
    from os import path
    # Hack-o-saurus rex strikes again!
    times = CMSman.maketimes(params['sim_starttime'],
                             params['sim_runtime'],
                             params['sim_timestep'],
                             return_timestamps=False)

    windfile = path.join(sim_dir, params['sim_name'] + '.wind.ave')
    windfile = open(windfile, 'r')
    windat = windfile.read().splitlines()
    windfile.close()
    speed, direc = zip(*[(float(speed), float(direc))
                         for speed, direc in [line.split()
                                              for line in windat]])

    speed = transpose(array(speed, ndmin=2))
    direc = transpose(array(direc, ndmin=2))
    times = transpose(array(times, ndmin=2))

    flow_params = h5py.File(path.join(sim_dir, params['sim_name'] + '_mp.h5'),
                            'a')
    del flow_params['PROPERTIES/Model Params/WindCurve/Magnitude']
    flow_params.create_dataset('PROPERTIES/Model Params/WindCurve/Magnitude',
                               data=speed)
    del flow_params['PROPERTIES/Model Params/WindCurve/Direction']
    flow_params.create_dataset('PROPERTIES/Model Params/WindCurve/Direction',
                               data=direc)
    del flow_params['PROPERTIES/Model Params/WindCurve/Times']
    flow_params.create_dataset('PROPERTIES/Model Params/WindCurve/Times',
                               data=times)
    flow_params.close()

    return None
예제 #7
0
파일: engfiles.py 프로젝트: serc/wave
def gen_eng_file(output_path, params):
    # This routine started out as makeWaveInput in prepareCMS.py

    model_config = CMSConfig(params["sim_name"]).load_sim_config()

    # DEFINE SPATIAL/TEMPORAL DOMAIN
    box = CMSman.makebox(model_config)
    steeringtimes = CMSman.maketimes(params["sim_starttime"], params["sim_runtime"], params["sim_timestep"])

    # RETRIEVE WAVE DATA FROM DATABASE
    wavdata = CMSman.getwavedata(box, steeringtimes, model_config)  # add wavtype
    if wavdata == None:
        print "\n... downloading new wave data ... \n"
        GETman.getWAVE(model_config, params["sim_starttime"], params["sim_runtime"], params["sim_timestep"])
        wavdata = CMSman.getwavedata(box, steeringtimes, model_config)  # add wavtype

    # CONSTRUCT THE FILE
    CMSman.gen_wavefiles(wavdata, steeringtimes, model_config, output_path)
예제 #8
0
파일: setup.py 프로젝트: serc/wave
def gen_wind_file(output_path, params):
  from wavecon import CMSman, GETman
  model_config = CMSConfig(params['sim_name']).load_sim_config()
  
  #DEFINE SPATIAL/TEMPORAL DOMAIN
  grid = CMSman.makegrid(model_config)
  steeringtimes = CMSman.maketimes(params['sim_starttime'],
    params['sim_runtime'], params['sim_timestep'])
  
  #RETRIEVE WIND DATA FROM DATABASE
  windata = CMSman.getwinddata(None,steeringtimes, model_config) #add wintype
  if (windata==None):
    print '\n... downloading new wind data ... \n'
    GETman.getWIND(model_config, params['sim_starttime'], params['sim_runtime'],
      params['sim_timestep'])
    windata = CMSman.getwinddata(None,steeringtimes, model_config) #add wintype
  
  # CONSTRUCT THE FILE
  CMSman.gen_windfiles(windata,grid,steeringtimes,model_config, output_path)
예제 #9
0
파일: setup.py 프로젝트: Mads-J/wave
def gen_wind_file(output_path, params):
    from wavecon import CMSman, GETman
    model_config = CMSConfig(params['sim_name']).load_sim_config()

    #DEFINE SPATIAL/TEMPORAL DOMAIN
    grid = CMSman.makegrid(model_config)
    steeringtimes = CMSman.maketimes(params['sim_starttime'],
                                     params['sim_runtime'],
                                     params['sim_timestep'])

    #RETRIEVE WIND DATA FROM DATABASE
    windata = CMSman.getwinddata(None, steeringtimes,
                                 model_config)  #add wintype
    if (windata == None):
        print '\n... downloading new wind data ... \n'
        GETman.getWIND(model_config, params['sim_starttime'],
                       params['sim_runtime'], params['sim_timestep'])
        windata = CMSman.getwinddata(None, steeringtimes,
                                     model_config)  #add wintype

    # CONSTRUCT THE FILE
    CMSman.gen_windfiles(windata, grid, steeringtimes, model_config,
                         output_path)
예제 #10
0
파일: engfiles.py 프로젝트: Mads-J/wave
def gen_eng_file(output_path, params):
    # This routine started out as makeWaveInput in prepareCMS.py

    model_config = CMSConfig(params['sim_name']).load_sim_config()

    #DEFINE SPATIAL/TEMPORAL DOMAIN
    box = CMSman.makebox(model_config)
    steeringtimes = CMSman.maketimes(params['sim_starttime'],
                                     params['sim_runtime'],
                                     params['sim_timestep'])

    #RETRIEVE WAVE DATA FROM DATABASE
    wavdata = CMSman.getwavedata(box, steeringtimes,
                                 model_config)  #add wavtype
    if (wavdata == None):
        print '\n... downloading new wave data ... \n'
        GETman.getWAVE(model_config, params['sim_starttime'],
                       params['sim_runtime'], params['sim_timestep'])
        wavdata = CMSman.getwavedata(box, steeringtimes,
                                     model_config)  #add wavtype

    # CONSTRUCT THE FILE
    CMSman.gen_wavefiles(wavdata, steeringtimes, model_config, output_path)