From 7d87a1644846b76eff334acaa16c9b57cd524501 Mon Sep 17 00:00:00 2001 From: James McManus Date: Tue, 16 Jul 2024 11:51:23 -0400 Subject: [PATCH] Moved if grid == 'NCSC_SAB_v1.23' or grid == 'hsofs': to above yml import --- kalpana/Kalpana.py | 80 ++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/kalpana/Kalpana.py b/kalpana/Kalpana.py index 508496c..6135109 100644 --- a/kalpana/Kalpana.py +++ b/kalpana/Kalpana.py @@ -209,48 +209,50 @@ def main(args): df = getADCIRCFileNameVariables(modelRunID) grid = df['ADCIRCgrid'].values[0] - # Read the runVariable.yml YAML file for the current run location and grid - with open('/data/kalpana/'+runLocation+'/'+grid+'/runVariables.yml', 'r') as file: - inputVariables = yaml.safe_load(file) - - # Define input variables extracting their values from YAML object - meshFile = '/data/kalpana/'+runLocation+'/'+grid+'/'+inputVariables['meshFilename'] - #dzFile = '/data/kalpana/dzFiles/'+grid+'/'+inputVariables['dzFilename'] - dzFile = '/data/kalpana/dzFiles/'+inputVariables['dzFilename'] - pathRasFiles = '/data/kalpana/'+runLocation+'/DEM/' - rasterFiles = inputVariables['rasterFiles'] - subDomain = '/data/kalpana/'+runLocation+'/DEM/'+rasterFiles - epsgIn = inputVariables['epsgIn'] - epsgOut = inputVariables['epsgOut'] - grassVer = inputVariables['grassVer'] - conLevelsLog = "-".join(map(str, conLevels)) - vUnitIn = inputVariables['vUnitIn'] - vUnitOut = inputVariables['vUnitOut'] - adcircVar = inputVariables['adcircVar'] - conType = inputVariables['conType'] - epsgSubDom = inputVariables['epsgSubDom'] - exportMesh = inputVariables['exportMesh'] - zeroDif = inputVariables['zeroDif'] - nameGrassLocation = inputVariables['nameGrassLocation'] - createGrassLocation = inputVariables['createGrassLocation'] - createLocMethod = inputVariables['createLocMethod'] - attrCol = inputVariables['attrCol'] - repLenGrowing = inputVariables['repLenGrowing'] - compAdcirc2dem = inputVariables['compAdcirc2dem'] - floodDepth = inputVariables['floodDepth'] - ras2vec = inputVariables['ras2vec'] - exportOrg = inputVariables['exportOrg'] - finalOutToLatLon = inputVariables['finalOutToLatLon'] - - # Convert leveesFile None string to None. The YAML file has None as a boolean, but python yaml sees it as a string? - if inputVariables['leveesFile'] == 'None': - leveesFile = None - else: - leveesFile = inputVariables['leveesFile'] - if grid == 'NCSC_SAB_v1.23' or grid == 'hsofs': logger.info('ncFile '+ncFile+' does use the '+grid+' grid, so begin processing') + # Read the runVariable.yml YAML file for the current run location and grid + with open('/data/kalpana/'+runLocation+'/'+grid+'/runVariables.yml', 'r') as file: + inputVariables = yaml.safe_load(file) + + # Define input variables extracting their values from YAML object + meshFile = '/data/kalpana/'+runLocation+'/'+grid+'/'+inputVariables['meshFilename'] + #dzFile = '/data/kalpana/dzFiles/'+grid+'/'+inputVariables['dzFilename'] + dzFile = '/data/kalpana/dzFiles/'+inputVariables['dzFilename'] + pathRasFiles = '/data/kalpana/'+runLocation+'/DEM/' + rasterFiles = inputVariables['rasterFiles'] + subDomain = '/data/kalpana/'+runLocation+'/DEM/'+rasterFiles + epsgIn = inputVariables['epsgIn'] + epsgOut = inputVariables['epsgOut'] + grassVer = inputVariables['grassVer'] + conLevelsLog = "-".join(map(str, conLevels)) + vUnitIn = inputVariables['vUnitIn'] + vUnitOut = inputVariables['vUnitOut'] + adcircVar = inputVariables['adcircVar'] + conType = inputVariables['conType'] + epsgSubDom = inputVariables['epsgSubDom'] + exportMesh = inputVariables['exportMesh'] + zeroDif = inputVariables['zeroDif'] + nameGrassLocation = inputVariables['nameGrassLocation'] + createGrassLocation = inputVariables['createGrassLocation'] + createLocMethod = inputVariables['createLocMethod'] + attrCol = inputVariables['attrCol'] + repLenGrowing = inputVariables['repLenGrowing'] + compAdcirc2dem = inputVariables['compAdcirc2dem'] + floodDepth = inputVariables['floodDepth'] + ras2vec = inputVariables['ras2vec'] + exportOrg = inputVariables['exportOrg'] + finalOutToLatLon = inputVariables['finalOutToLatLon'] + + # Convert leveesFile None string to None. The YAML file has None as a boolean, but python yaml sees it as a string? + if inputVariables['leveesFile'] == 'None': + leveesFile = None + else: + leveesFile = inputVariables['leveesFile'] + + logger.info('ncFile '+ncFile+' does use the '+grid+' grid, so begin processing') + # Create outputs directory for second process shape, and tiff files outputDir = "/".join(pathOut.split('/')[0:-1])+'/' finalDir = "/".join(outputDir.split('/')[0:-3])+'/final/kalpana/'+runLocation+'/'