1# -*- coding: utf-8 -*-

2

3 import os

4 import sys

5

6 from ElementTree import Element, ElementTree, SubElement, dump, parse, tostring

7

8

9 class make(object):

10 def __init__(self):

11 self.ProjectFile = ""

12

13 # New Project 시에 GMP 파일 생성 하기

14 def Make_GMP_File(self, save_gmp_path):

15 GRMProject = Element("GRMProject")

16 GRMProject.set("xmlns", "http://tempuri.org/GRMProject.xsd")

17 ProjectSettings = SubElement(GRMProject, "ProjectSettings")

18 SubElement(ProjectSettings, "ProjectFile").text = save_gmp_path

19 SubElement(ProjectSettings, "GRMSimulationType").text = "SingleEvent"

20 SubElement(ProjectSettings, "DomainFile")

21 SubElement(ProjectSettings, "SlopeFile")

22 SubElement(ProjectSettings, "FlowDirectionFile")

23 SubElement(ProjectSettings, "FlowAccumFile")

24 SubElement(ProjectSettings, "StreamFile")

25 SubElement(ProjectSettings, "ChannelWidthFile")

26 SubElement(ProjectSettings, "InitialSoilSaturationRatioFile")

27 SubElement(ProjectSettings, "LandCoverDataType").text = "File"

28 SubElement(ProjectSettings, "LandCoverFile")

29 SubElement(ProjectSettings, "LandCoverVATFile")

30 SubElement(ProjectSettings, "ConstantRoughnessCoeff")

31 SubElement(ProjectSettings, "ConstantImperviousRatio")

32 SubElement(ProjectSettings, "SoilTextureDataType").text = "File"

33 SubElement(ProjectSettings, "SoilTextureFile")

34 SubElement(ProjectSettings, "SoilTextureVATFile")

35 SubElement(ProjectSettings, "ConstantSoilPorosity")

36 SubElement(ProjectSettings, "ConstantSoilEffPorosity")

37 SubElement(ProjectSettings, "ConstantSoilWettingFrontSuctionHead")

38 SubElement(ProjectSettings, "ConstantSoilHydraulicConductivity")

39 SubElement(ProjectSettings, "SoilDepthDataType").text = "File"

40 SubElement(ProjectSettings, "SoilDepthFile")

41 SubElement(ProjectSettings, "SoilDepthVATFile")

42 SubElement(ProjectSettings, "ConstantSoilDepth")

43 SubElement(ProjectSettings, "InitialChannelFlowFile")

44 SubElement(ProjectSettings, "FlowDirectionType").text = "StartsFromE_TauDEM"

45 SubElement(ProjectSettings, "GridCellSize")

46 # SubElement(ProjectSettings, 'IsParallel').text = 'true'

47 SubElement(ProjectSettings, "MaxDegreeOfParallelism").text = "-1"

48 SubElement(ProjectSettings, "SimulationStartingTime").text = "0"

49 SubElement(ProjectSettings, "ComputationalTimeStep")

50 SubElement(ProjectSettings, "IsFixedTimeStep").text = "false"

51 SubElement(ProjectSettings, "SimulationDuration")

52 SubElement(ProjectSettings, "OutputTimeStep")

53 SubElement(ProjectSettings, "SimulateInfiltration").text = "true"

54 SubElement(ProjectSettings, "SimulateSubsurfaceFlow").text = "true"

55 SubElement(ProjectSettings, "SimulateBaseFlow").text = "true"

56 SubElement(ProjectSettings, "SimulateInterception").text = "true"

57 SubElement(ProjectSettings, "SimulateEvapotranspiration").text = "true"

58 SubElement(ProjectSettings, "SimulateSnowMelt").text = "true"

59 SubElement(ProjectSettings, "SimulateFlowControl").text = "true"

60 SubElement(ProjectSettings, "CrossSectionType").text = "CSSingle"

61 SubElement(ProjectSettings, "SingleCSChannelWidthType").text = "CWGeneration"

62 SubElement(ProjectSettings, "ChannelWidthEQc")

63 SubElement(ProjectSettings, "ChannelWidthEQd")

64 SubElement(ProjectSettings, "ChannelWidthEQe")

65 SubElement(ProjectSettings, "ChannelWidthMostDownStream")

66 SubElement(ProjectSettings, "LowerRegionHeight")

67 SubElement(ProjectSettings, "LowerRegionBaseWidth")

68 SubElement(ProjectSettings, "UpperRegionBaseWidth")

69 SubElement(ProjectSettings, "CompoundCSIniFlowDepth")

70 SubElement(ProjectSettings, "CompoundCSChannelWidthLimit")

71 SubElement(ProjectSettings, "BankSideSlopeRight").text = "1.5"

72 SubElement(ProjectSettings, "BankSideSlopeLeft").text = "1.5"

73 SubElement(ProjectSettings, "MakeIMGFile").text = "false"

74 SubElement(ProjectSettings, "MakeASCFile").text = "false"

75 SubElement(ProjectSettings, "MakeSoilSaturationDistFile").text = "true"

76 SubElement(ProjectSettings, "MakeRfDistFile").text = "true"

77 SubElement(ProjectSettings, "MakeRFaccDistFile").text = "true"

78 SubElement(ProjectSettings, "MakeFlowDistFile").text = "true"

79 SubElement(ProjectSettings, "PrintOption").text = "All"

80 SubElement(ProjectSettings, "PrintAveValue").text = "false"

81 SubElement(ProjectSettings, "AveValueTimeInterval_min")

82 SubElement(ProjectSettings, "WriteLog").text = "false"

83 SubElement(ProjectSettings, "AboutThisProject")

84 SubElement(ProjectSettings, "AboutWatershed")

85 SubElement(ProjectSettings, "AboutLandCoverMap")

86 SubElement(ProjectSettings, "AboutSoilMap")

87 SubElement(ProjectSettings, "AboutSoilDepthMap")

88 SubElement(ProjectSettings, "AboutRainfall")

89 SubElement(ProjectSettings, "ProjectSavedTime")

90 SubElement(ProjectSettings, "ComputerName")

91 SubElement(ProjectSettings, "ComputerUserName")

92 SubElement(ProjectSettings, "GRMVersion")

93 ElementTree(GRMProject).write(

94 save_gmp_path, encoding="utf-8", xml_declaration=True

95 )