PecanProject / pecan

The Predictive Ecosystem Analyzer (PEcAn) is an integrated ecological bioinformatics toolbox.
www.pecanproject.org
Other
202 stars 233 forks source link

Use YAML instead of XML for settings file #2943

Open Aariq opened 2 years ago

Aariq commented 2 years ago

Just wondering if it might improve usability to use YAML for settings rather than XML (or as an alternative option). YAML is a bit more human-readable and can be read to and written from R lists with the yaml package.

An example settings.xml converted to YAML:

outdir: /data/output/pecan_runs/temp_comp_results/rn
database:
  bety:
    driver: PostgreSQL
    user: bety
    password: bety
    host: postgres
    dbname: bety
    write: no
  dbfiles: /data/output/pecan_runs/temp_comp_results/rn/dbfiles
pfts:
  pft:
    name: SetariaWT_ME034
    outdir: /data/output/pecan_runs/temp_comp_results/rn/pft/SetariaWT_ME034
    constants:
      file: ~/model-vignettes/BioCro/DARPA/temp_comparison/inputs/setaria.constants.xml
ensemble:
  size: '100'
  variable:
  - TotLivBiom
  - TVeg
  - AGB
  samplingspace:
    parameters:
      method: halton
  start.year: 2019.0
  end.year: 2019.0
meta.analysis:
  iter: '30000'
  random.effects:
    'on': yes
    use_ghs: yes
  threshold: '1.2'
  update: 'TRUE'
  treatment: regular night temperature
sensitivity.analysis:
  variable:
  - TotLivBiom
  - TVeg
  - AGB
  start.year: 2019.0
  end.year: 2019.0
model:
  type: BIOCRO
  binary: ~/pecan/models/biocro/inst/biocro.Rscript
  revision: '0.95'
  id: 9.0e+09
  delete.raw: no
run:
  site:
    id: '9000000004'
    name: Donald Danforth Plant Science Center Growth Chamber
    lat: 38.674593
    lon: -90.397189
  inputs:
    met:
      output: BIOCRO
      path:
        path1: ~/model-vignettes/BioCro/DARPA/temp_comparison/inputs/weather.rn
  start.date: 2019/01/01
  end.date: 2019/04/10
host:
  name: localhost
  rundir: /data/output/pecan_runs/temp_comp_results/rn/run
  outdir: /data/output/pecan_runs/temp_comp_results/rn/out
settings.info:
  deprecated.settings.fixed: yes
  settings.updated: yes
  checked: yes
workflow:
  id: 2022-06-22-14-50-32
rundir: /data/output/pecan_runs/temp_comp_results/rn/run
modeloutdir: /data/output/pecan_runs/temp_comp_results/rn/out
mdietze commented 2 years ago

Fair idea, but I don't think it's a high priority issue. Given the number of things that are "broken" I tend to leave the "if it's not broke, don't fix it" things alone.

Aariq commented 1 year ago

Apparently YAML is much worse off than I thought, but TOML sounds like a good option. https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell