Skip to content

Commit d0a0cee

Browse files
committed
Updated EUM items and units matching 22.1.0
1 parent 6ebbb1a commit d0a0cee

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

MIKECore.pyproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
<VisualStudioVersion Condition=" '$(VisualStudioVersion)' == '' ">10.0</VisualStudioVersion>
2222
</PropertyGroup>
2323
<ItemGroup>
24+
<Compile Include="buildUtil\eumXMLProcess.py">
25+
<SubType>Code</SubType>
26+
</Compile>
2427
<Compile Include="mikecore\Dfs123File.py">
2528
<SubType>Code</SubType>
2629
</Compile>
@@ -131,6 +134,7 @@
131134
<ItemGroup>
132135
<Folder Include="mikecore\" />
133136
<Folder Include="miketools\" />
137+
<Folder Include="buildUtil\" />
134138
<Folder Include="tests\" />
135139
</ItemGroup>
136140
<ItemGroup>

buildUtil/eumXMLProcess.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Helper script to create/update the list of eumItem and eumUnit,
2+
# reading from the EUM.xml file. From the root folder, run:
3+
#
4+
# python.exe ./buildUtil/eumXMLProcess.py > eumItemUnit.txt
5+
#
6+
# then compare eumItemUnit.txt with the ./mikecore/eum.py
7+
# and copy over the missing items and units.
8+
#
9+
# This requires that the BuildNativeBin.bat has been run,
10+
# to find the EUM.xml in the right position.
11+
12+
import re
13+
14+
# Using readlines()
15+
eumFile = open('build/lib/mikecore/bin/windows/EUM.xml', 'r')
16+
eumLines = eumFile.readlines()
17+
eumFile.close()
18+
19+
recItem = re.compile('"(eumI\w+)" MzId="(\w*)"')
20+
recUnit = re.compile('"(eumU\w+)" MzId="(\w*)"')
21+
22+
itemDict = {}
23+
unitDict = {}
24+
for line in eumLines:
25+
match = recItem.search(line)
26+
if match:
27+
itemDict[int(match.group(2))] = match.group(1)
28+
match = recUnit.search(line)
29+
if match:
30+
unitDict[int(match.group(2))] = match.group(1)
31+
32+
itemKeys = list(itemDict.keys())
33+
unitKeys = list(unitDict.keys())
34+
35+
itemKeys.sort()
36+
unitKeys.sort()
37+
38+
print("# Predefined enums of EUM item types.");
39+
print("#");
40+
print("# Must be updated with every new release, or if the EUM.xml is updated");
41+
print("# Run buildUtil\eumXMLProcess.py to create the lists");
42+
print("class eumItem(IntEnum):");
43+
for key in itemKeys:
44+
print(" {} = {}".format(itemDict[key], key))
45+
46+
print("")
47+
print("# Predefined enums of EUM units.")
48+
print("#")
49+
print("# Must be updated with every new release, or if the EUM.xml is updated")
50+
print("class eumUnit(IntEnum):")
51+
for key in unitKeys:
52+
print(" {} = {}".format(unitDict[key], key))
53+

mikecore/eum.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# Predefined enums of EUM item types.
88
#
99
# Must be updated with every new release, or if the EUM.xml is updated
10+
# Run buildUtil\eumXMLProcess.py to create the lists
1011
class eumItem(IntEnum):
1112
eumIItemUndefined = 999
1213
eumIWaterLevel = 100000
@@ -592,10 +593,18 @@ class eumItem(IntEnum):
592593
eumIMassPerLengthPerTime = 110306
593594
eumINearBedLoadPerLength = 110307
594595
eumISubstancePerUnitArea = 110308
595-
eumIAccNearBedLoadPerLength = 110309
596+
eumIAccNearBedLoadPerLength = 110309
596597
eumIThermalConductivity = 110310
597598
eumIDirectionalVariance = 110311
598599
eumISpecificDissipationRate = 110312
600+
eumIAngularFrequency = 110313
601+
eumIStemDiameter = 110314
602+
eumIVegetationDensity = 110315
603+
eumIElasticModulus = 110316
604+
eumIBladeWidth = 110317
605+
eumIBladeThickness = 110318
606+
eumIPlantDensity = 110319
607+
eumIThickness = 110320
599608

600609
# Predefined enums of EUM units.
601610
#
@@ -768,6 +777,7 @@ class eumUnit(IntEnum):
768777
eumUouncePerYardUS3 = 2219
769778
eumUouncePerSquareFeet = 2220
770779
eumUouncePerSquareFeetUS = 2221
780+
eumUgramPerCubicCentimeter = 2222
771781
eumUKiloGramPerMeterPerSecond = 2300
772782
eumUPascalSecond = 2301
773783
eumUkilogramPerMeterPerDay = 2302
@@ -1054,6 +1064,7 @@ class eumUnit(IntEnum):
10541064
eumUmilliBar = 6108
10551065
eumUmicroPascal = 6109
10561066
eumUdeciBar = 6110
1067+
eumUGigaPascal = 6111
10571068
eumUdB_re_1muPa2second = 6150
10581069
eumUdBperLambda = 6160
10591070
eumUPSU = 6200
@@ -1122,6 +1133,7 @@ class eumUnit(IntEnum):
11221133
eumUPerAcre = 9301
11231134
eumUPerHectar = 9302
11241135
eumUperKm2 = 9303
1136+
eumUPerSquareFeet = 9304
11251137
eumUPerCubicMeter = 9350
11261138
eumUCurrencyPerCubicMeter = 9351
11271139
eumUCurrencyPerCubicFeet = 9352

0 commit comments

Comments
 (0)