From 5351ea8a0d234d4a2b8e1e62c803d7f3cfeb0f4d Mon Sep 17 00:00:00 2001 From: "ali.mahdavi" Date: Mon, 22 Nov 2021 09:43:13 -0500 Subject: [PATCH] In XMDFC the variables are in the main file but in the XMDF file it is under another variable called Datasets. Therefore in pyHMT2D in SRH_2D_Data.py in the function called readSRHXMDFFile I added one if. also Guid is an extra variable we don't need so I added to to the if. --- pyHMT2D/Hydraulic_Models_Data/SRH_2D/SRH_2D_Data.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pyHMT2D/Hydraulic_Models_Data/SRH_2D/SRH_2D_Data.py b/pyHMT2D/Hydraulic_Models_Data/SRH_2D/SRH_2D_Data.py index dd3ef60..fc63ae5 100644 --- a/pyHMT2D/Hydraulic_Models_Data/SRH_2D/SRH_2D_Data.py +++ b/pyHMT2D/Hydraulic_Models_Data/SRH_2D/SRH_2D_Data.py @@ -1539,7 +1539,9 @@ def output_boundary_manning_n_profile(self, nodeStringID, nodeStringFileName, di def readSRHXMDFFile(self, xmdfFileName, bNodal): - """ Read SRH-2D result file in XMDF format (current version 13.1.6 of SMS only support data at node). + """ Read SRH-2D result file in XMDFC format (In current version 13.1.6 of SMS, the initial results of SRH2D is saved at center + of the elements (XMDFC file). and using post processing they are interpolated to the nodes (XMDF) file). Currently + the pyHMT2D support XMDFC files created befpre post processing. Parameters ---------- @@ -1569,6 +1571,9 @@ def readSRHXMDFFile(self, xmdfFileName, bNodal): if gVerbose: print("Reading the XMDF file ...\n") xmdfFile = h5py.File(xmdfFileName, "r") + + if bNodal: #It is added by Ali because when it is nodal + xmdfFile=xmdfFile['Datasets'] #variables are inside Datasets #build the list of solution variables varNameList = [] @@ -1579,7 +1584,7 @@ def readSRHXMDFFile(self, xmdfFileName, bNodal): for ds in xmdfFile.keys(): #print(ds) - if ds != "File Type" and ds != "File Version": + if ds != "File Type" and ds != "File Version" and ds != "Guid": #Ali added Guide for Nodal files if "Velocity" in ds: varNameVelocity = '%s' % ds vel_x = ds.replace("Velocity","Vel_X",1)