ModelParameterDictionary

Tool written in Python for reading model input parameters from a simple formatted text file.

input parametersread in

true

Contributor(s)

Initial contribute: 2021-09-10

Authorship

:  
University of Colorado
:  
Gregory.Tucker@colorado.edu
:  
View
Is authorship not correct? Feed back

Classification(s)

Application-focused categoriesNatural-perspectiveLand regions
Application-focused categoriesNatural-perspectiveAtmospheric regions

Detailed Description

English {{currentDetailLanguage}} English

Quote from: https://csdms.colorado.edu/wiki/Model:ModelParameterDictionary

  The Model Parameter Dictionary is a tool for numerical modelers to easily read and access model parameters from a simple formatted input (text) file. Each parameter has a KEY, which identifies the parameter, and a VALUE, which can be a number or a string. A ModelParameterDictionary object reads model parameters from an input file to a Dictionary, and provides functions for the user to look up particular parameters by key name.

The format of the input file looks like:

  PI: the text "PI" is an example of a KEY 3.1416 AVOGADROS_NUMBER: this is another 6.022e23 FAVORITE_FRUIT: yet another mangoes NUMBER_OF_MANGO_WALKS: this one is an integer 4 ALSO_LIKES_APPLES: this is a boolean true

  Example code that reads these parameters from a file called "myinputs.txt":

my_param_dict = ModelParameterDictionary()
my_param_dict.read_from_file( 'myinputs.txt' )
pi = my_param_dict.read_float( 'PI' )
avogado = my_param_dict.read_float( 'AVOGADROS_NUMBER' )
fruit = my_param_dict.read_string( 'FAVORITE_FRUIT' )
nmang = my_param_dict.read_int( 'NUMBER_OF_MANGO_WALKS' )
apples_ok = my_param_dict.read_bool( 'ALSO_LIKES_APPLES' )

  As in Python, hash marks (#) denote comments. The rules are that each key must have one and only one parameter value, and each value must appear on a separate line immediately below the key line.

  Also available are functions to read input parameters from the command line (e.g., read_float_cmdline( 'PI' ) )

模型元数据

{{htmlJSON.HowtoCite}}

Greg Tucker (2021). ModelParameterDictionary, Model Item, OpenGMS, https://geomodeling.njnu.edu.cn/modelItem/8b88716f-9e47-4c15-82af-1739cd098198
{{htmlJSON.Copy}}

Contributor(s)

Initial contribute : 2021-09-10

{{htmlJSON.CoContributor}}

Authorship

:  
University of Colorado
:  
Gregory.Tucker@colorado.edu
:  
View
Is authorship not correct? Feed back

History

Last modifier
HaoCheng Wang
Last modify time
2021-09-18
Modify times

QR Code

×

{{curRelation.overview}}
{{curRelation.author.join('; ')}}
{{curRelation.journal}}









{{htmlJSON.RelatedItems}}

{{htmlJSON.LinkResourceFromRepositoryOrCreate}}{{htmlJSON.create}}.

Drop the file here, orclick to upload.
Select From My Space
+ add

{{htmlJSON.authorshipSubmitted}}

Cancel Submit
{{htmlJSON.Cancel}} {{htmlJSON.Submit}}
{{htmlJSON.Localizations}} + {{htmlJSON.Add}}
{{ item.label }} {{ item.value }}
{{htmlJSON.ModelName}}:
{{htmlJSON.Cancel}} {{htmlJSON.Submit}}
名称 别名 {{tag}} +
系列名 版本号 目的 修改内容 创建/修改日期 作者
摘要 详细描述
{{tag}} + 添加关键字
* 时间参考系
* 空间参考系类型 * 空间参考系名称

起始日期 终止日期 进展 开发者
* 是否开源 * 访问方式 * 使用方式 开源协议 * 传输方式 * 获取地址 * 发布日期 * 发布者



编号 目的 修改内容 创建/修改日期 作者





时间分辨率 时间尺度 时间步长 时间范围 空间维度 格网类型 空间分辨率 空间尺度 空间范围
{{tag}} +
* 类型
图例


* 名称 * 描述
示例描述 * 名称 * 类型 * 值/链接 上传


{{htmlJSON.Cancel}} {{htmlJSON.Submit}}
Title Author Date Journal Volume(Issue) Pages Links Doi Operation
{{htmlJSON.Cancel}} {{htmlJSON.Submit}}
{{htmlJSON.Add}} {{htmlJSON.Cancel}}

{{articleUploading.title}}

Authors:  {{articleUploading.authors[0]}}, {{articleUploading.authors[1]}}, {{articleUploading.authors[2]}}, et al.

Journal:   {{articleUploading.journal}}

Date:   {{articleUploading.date}}

Page range:   {{articleUploading.pageRange}}

Link:   {{articleUploading.link}}

DOI:   {{articleUploading.doi}}

Yes, this is it Cancel

The article {{articleUploading.title}} has been uploaded yet.

OK
{{htmlJSON.Cancel}} {{htmlJSON.Confirm}}