Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cmtbSettings
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ hpcSettings:
hpcCores: 36
hpcNodes: 1
testName: ''
hotStartFlag: false
slack:
logfileLoc: ./data/logs
workingDirectory: ./data # this is the directory where simulation files and QA/QC plots are made and existing architecture takes over
netCDFdir: ./thredds_data # this is the base directory where netCDF files are output
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The test bed is established at the USACE CHL Field REsearch Facility in Duck, No
- conda install <package>

conda install -c conda-forge cartopy
* netCDF4, pyproj, utm, wavespectra, progressbar, opencv-python
* netCDF4, pyproj, utm (cf), wavespectra (cf), progressbar (cf), opencv (cf)

- there's likely more, please add as you find!! :-[]

Expand Down
16 changes: 10 additions & 6 deletions frontback/frontBackNEW.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def ww3simSetup(startTimeString, inputDict, allWind , allWL, allWave, wrr):
print("Model Time Start : %s Model Time End: %s" % (startTime, endTime))

# __________________Make Diretories_____________________________________________
fileHandling.makeCMTBfileStructure(pathPrefix)
fileHandling.makeCMTBfileStructure(wrr.workingDirectory)
print(wrr.workingDirectory)

# ____________________________ begin model data gathering __________________________________________________________
gdTB = getDataTestBed(startTime, endTime) # initialize get data test bed (bathy)
Expand All @@ -69,7 +70,7 @@ def ww3simSetup(startTimeString, inputDict, allWind , allWL, allWave, wrr):
assert rawspec is not None, "\n++++\nThere's No Wave data between %s and %s \n++++\n" % (startTime, endTime)
# use generated time lists for these to provide accurate temporal values
_, waveTimeList, wlTimeList, _, windTimeList = prepdata.createDifferentTimeLists(startTime, endTime, rawspec, rawWL,
rawWind=rawwind)
rawWind=rawwind,simTs=30*60)
nFreq = np.size(rawspec['wavefreqbin'])
# rotate and lower resolution of directional wave spectra
wavepacket = prepdata.prep_spec(rawspec, version_prefix, datestr=dateString, plot=plotFlag, full=full, deltaangle=10,
Expand Down Expand Up @@ -221,9 +222,12 @@ class objects as listed below:
if postProcessingDict['phaseResolved'] == True:
spatialPostProcessed = postData.processNLwave(spatialData, wrr=wrr, ncFilesOnly=False)
pointPostProcessed = None
elif postProcessingDict['phaseAveraged'] == True:
spatialPostProcessed = postData.processPAwave(spatialData, wrr=wrr, ncFilesOnly=False)
pointPostProcessed = postData.processPAStationWave(pointData, wrr=wrr, ncFilesOnly=False)
else:
spatialPostProcessed, pointPostProcessed = someFunctionPostProcesing(spatialData, pointData)

# __________________________2. make netCDF Files________________________________
# __________________________2a. Spatial output _________________________________

Expand Down Expand Up @@ -255,21 +259,21 @@ class objects as listed below:
elif postProcessingDict['phaseAveraged'] is True:
variables = ncfile.variables.keys()
for var in variables:
if var in ['waveHs', 'waveDm', 'waveTm'] and plotFlag is True:
if var in ['waveHs', 'waveMeanDirection', 'waveTm'] and plotFlag is True:
plotOutFname = 'test.png'
oP.unstructuredSpatialPlot(plotOutFname, fieldNc=ncfile, variable=var)
else:
raise NotImplementedError("other model plotting types haven't been implemented yet")
# __________________________2b. point output _________________________________
if pointPostProcessed is not None:
print(' post-processing point data is not developed yet')
print(' post-processing point data')
fldrArch = os.path.join(model, version_prefix)
varYaml_fname = f'yaml_files/waveModels/{fldrArch}/Station_var.yml'
globalyaml_fname = f'yaml_files/waveModels/{fldrArch}/Station_globalmeta.yml'
# frame work is shown below, post processing lays out nice nested dictionary for every save station
for ss, station in enumerate(pointPostProcessed['stationList']):
outFileName = fileHandling.makeTDSfileStructure(Thredds_Base, fldrArch, dateString, station)
p2nc.makenc_generic(outFileName, globalyaml_fname, varYaml_fname, pointPostProcessed[ss])
p2nc.makenc_generic(outFileName, globalyaml_fname, varYaml_fname, pointPostProcessed[station])
# __________________________2bb. point plotting ________________________________
print("is this necessary??")

Expand Down
21 changes: 11 additions & 10 deletions genericWorkFlow.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def Master_workFlow(inputDict):
pbsFlag = inputDict['pbsFlag']
analyzeFlag = inputDict['analyzeFlag']
plotFlag = inputDict['plotFlag']
hotStartFlag = inputDict['hotStartFlag']
hotStartDirectory = inputDict.get('hotStartDirectory',None)
modelName = inputDict['modelSettings'].get('modelName', None)
log = inputDict.get('logging', True)
updateBathy = inputDict.get('updateBathy', None)
Expand All @@ -44,6 +46,7 @@ def Master_workFlow(inputDict):
workingDirectory = os.path.join(cmtbRootDir,workingDir[2:],modelName.lower(), version_prefix)
else:
workingDirectory = os.path.join(workingDir, modelName.lower(), version_prefix)
print(workingDirectory)
inputDict['netCDFdir'] = os.path.join(inputDict['netCDFdir'], 'waveModels')
inputDict['path_prefix'] = workingDirectory
# ______________________ Logging/FileHandling ____________________________
Expand Down Expand Up @@ -94,9 +97,8 @@ def Master_workFlow(inputDict):
if modelName in ['ww3']:
wrr = wrrClass.ww3io(workingDirectory=workingDirectory,testName=testName, versionPrefix=version_prefix,
startTime=DT.datetime.strptime(time, '%Y-%m-%dT%H:%M:%SZ'),
endTime=DT.datetime.strptime(time, '%Y-%m-%dT%H:%M:%SZ') + DT.timedelta(
hours=inputDict['simulationDuration']), runFlag=runFlag,
generateFlag=generateFlag, readFlag=analyzeFlag, pbsFlag=pbsFlag)
endTime=DT.datetime.strptime(endTime, '%Y-%m-%dT%H:%M:%SZ'), runFlag=runFlag,
generateFlag=generateFlag, readFlag=analyzeFlag, pbsFlag=pbsFlag, hotStartFlag=hotStartFlag)

if generateFlag is True:
wavePacket, windPacket, wlPacket, bathyPacket, gridFname, wrr = frontBackNEW.ww3simSetup(time,
Expand Down Expand Up @@ -156,25 +158,24 @@ def Master_workFlow(inputDict):
print("windPacket has keys: {}".format(windPacket.keys()))
except AttributeError:
pass

if pbsFlag is True:
wrr.hpcCores = inputDict['hpcSettings']['hpcCores']
wrr.hpcNodes = inputDict['hpcSettings']['hpcNodes']
print(updateBathy)
# write simulation files (if assigned)
wrr.writeAllFiles(wavePacket=wavePacket, windPacket=windPacket, wlPacket=wlPacket,
bathyPacket=bathyPacket, gridfname=gridFname,
ctdPacket=ctdPacket, updateBathy=updateBathy)
ctdPacket=ctdPacket, updateBathy=updateBathy,hotStartDirectory=hotStartDirectory)

# run simulation (as appropriate)
if runFlag is True:
wrr.runSimulation(modelExecutable=inputDict['modelExecutable'])
if pbsFlag is True:
wrr.hpcCores = inputDict['hpcSettings']['hpcCores']
wrr.hpcNodes = inputDict['hpcSettings']['hpcNodes']
wrr.runSimulation(modelExecutable=inputDict['modelExecutable'],hotStartDirectory=hotStartDirectory)

# post process (as appropriate)
if analyzeFlag == True:
spatialData, savePointData = wrr.readAllFiles()
frontBackNEW.genericPostProcess(time, inputDict, spatialData=spatialData, pointData=savePointData,
wrr=wrr)

# if it's a live run, move the plots to the output directory
if plotFlag is True and DT.date.today() == projectEnd or inputDict['slack'] is not None:
from testbedutils import cmtbSlack
Expand Down
2 changes: 1 addition & 1 deletion getdatatestbed
Submodule getdatatestbed updated 1 files
+33 −37 getDataFRF.py
79 changes: 79 additions & 0 deletions grids/ww3/unww3_Irene_REFACTORED.inbnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
90824 1 F
91618 1 F
92398 1 F
93168 1 F
93934 1 F
94692 1 F
95450 1 F
96197 1 F
96931 1 F
97653 1 F
98367 1 F
99073 1 F
99772 1 F
100464 1 F
101151 1 F
101835 1 F
102511 1 F
103179 1 F
103844 1 F
104504 1 F
105163 1 F
105817 1 F
106471 1 F
107117 1 F
107758 1 F
108391 1 F
109020 1 F
109655 1 F
110298 1 F
110935 1 F
111564 1 F
112185 1 F
112801 1 F
113419 1 F
113448 1 F
113447 1 F
113446 1 F
113445 1 F
113444 1 F
113443 1 F
113442 1 F
113441 1 F
113440 1 F
113439 1 F
113438 1 F
113437 1 F
113436 1 F
113435 1 F
113434 1 F
113433 1 F
113432 1 F
113431 1 F
113430 1 F
113429 1 F
113428 1 F
113427 1 F
113426 1 F
113425 1 F
113424 1 F
113423 1 F
113422 1 F
113421 1 F
113420 1 F
113413 1 F
113412 1 F
113411 1 F
113410 1 F
113409 1 F
113408 1 F
113407 1 F
113221 1 F
113217 1 F
112602 1 F
111983 1 F
111356 1 F
110722 1 F
110086 1 F
109438 1 F
109437 1 F
Loading