param.py

Script for manipulating dvmdostem parameter files.

usage: param.py [-h] [--reformat-block FILE CMT] [--enforce-initvegc FILE CMT] [--replace-cmt-block AFILE BFILE CMTNUM] [--compare-cmtblocks AFILE ANUM BFILE BNUM]
                [--dump-block-to-json FILE CMT] [--dump-block FILE CMT] [--fmt-block-from-json INFILE REFFILE] [--report-pft-names INFOLDER CMTNUM]
                [--report-pft-stats INFOLDER CMTNUM] [--report-cmt-names INFOLDER CMTNUM] [--report-all-cmts FOLDER] [--plot-static-lai INFOLDER CMT]
                [--extract-cmt INFOLDER CMTKEY DST] [--csv-v1-spec] [--fwt2csv-v1 PARAMDIR REQ_CMTS TARGETS] [--csv2fwt-v1 CSV REFPARAMS REFTARGETS]
                [--csv-v0-2cmtdatablocks CSVFILE CMTNAME] [--csv-v0-spec] [--params2csv-v0 PARAMFOLDER CMTKEY]

Named Arguments

--reformat-block

??

--enforce-initvegc
Reads data from cmt_bgcvegetation.txt file for

the specified community and adjusts the cpart compartment parmeters so as to match the proportions of the initvegc compartment parameters. Re-formats the block of data and prints to stdout.

--replace-cmt-block
Replaces the CMT datablock in AFILE with the

contents CMT data in BFILE. Assumes that the CMTNUM exists in both files!

--compare-cmtblocks
Do a line by line comparison of the CMT data blocks

in FILEA and FILEB. The comparison ignores whitespace and numeric formatting. prints report indicating which lines match.

--dump-block-to-json
Extract the specific CMT data block from the

specified data input file and print the contents to stdout as a json object (string).

--dump-block
Extract the specific CMT data block from the

specified input file and print the contents to stdout

--fmt-block-from-json
Reads infile (assumed to be a well formed data

dict of dvmdostem parameter data in json form), formats the block according to the reffile, and spits contents back to stdouts

--report-pft-names
Prints the PFT name lines for each parameter file

so that it is easy to visually check that all the PFTs are named exactly the same for the given (‘INFOLDER’, ‘CMTNUM’). Might require a wide screen to view the columns lined up appropriately! Prints n/a if the CMT does not exist in the file.

--report-pft-stats
Prints a tables summarizing the amount of C and N

allocated to each PFT and the percent contribution to the ecosystem totals of C and N. Assumes that a file ‘cmt_bgcvegetation.txt’ exists in the INFOLDER.

--report-cmt-names
Prints the CMT number and name for each file.

Prints n/a if the CMT does not exist in the file!

--report-all-cmts
Prints out a table with all the CMT names found

in each file found in the FOLDER. Only looks at files named like: ‘cmt_*.txt’ in the FOLDER.

--plot-static-lai
Makes plots of the static_lai parameter.

static_lai is a monthly value, so each PFT has 12 entries in the parameter file. The plot shows the values over the year so you can check the seasonality. Looks a ‘cmt_dimvegetation.txt file in the INFOLDER.

--extract-cmt
Given a folder of parameter files, and a CMT

number, this will open each file, copy the block of data for the CMT and paste that block in to a new file named DST/cmt_*.txt.

--csv-v1-spec

Print the specification for the supported csv files, v1.

Default: False

--fwt2csv-v1
Converts all the parameters found in the files in

PARAMDIR into csv format, creating one csv file for each requested CMT. REQ_CMTs should be a comma separatedlist of CMT numbers. The resulting csv file will be v1, and will have the targets included as found in the TARGETS file.

--csv2fwt-v1
Converts the input CSV file into the standard

dvmdostem Fixed Width Text parameter format. The CSV file must conform to the v1 specification and must have all info present! Prints the resulting data to stdout in a format that can be copied into new or existing dvmdostem parameter files. Also prints the targets data such that if can be copied into an existing targets file, although the key order may not match the hand-formatted targets.

--csv-v0-2cmtdatablocks
(DEPRECATED!!) Reads data from csv file and prints

CMT datablocks to stdout. Expected workflow is that user starts with a spreadsheet that is exported to csv, then use this feature is used to parse the csv and print formatted sections of data to stdout that can be pasted into the standard dvmdostem space delimited text files that are used for parameters.

--csv-v0-spec

(DEPRECATED!!) Print the specification for supported csv files, v0.

Default: False

--params2csv-v0

(DEPRECATED!!) Dumps a parameter file to csv format.