GEO-BON / bon-in-a-box-pipelines

BON in a Box 2.0 - Sampling optimisation and indicator pipelines
MIT License
11 stars 7 forks source link

Put script for loading inputs and creating outputs in functions for R, Julia and Python #119

Open glaroc opened 1 year ago

glaroc commented 1 year ago

Create functions that are sourced for all scripts that load the inputs.json and saves the outputs.json.

gottacatchenall commented 1 year ago

For Julia, for input metadata it's easy enough to copy and paste from https://github.com/GEO-BON/boninabox-pipelines/blob/e82654c6ad0bfbe8113ba156d6ffb186bd982991/scripts/Block3/shared.jl#L1

and add using JSON at the top.

And for outputs, something like

function write_outputs(runtime_dir, output_dict)
    output_json_path = joinpath(runtime_dir,  "output.json")
    open(output_json_path, "w") do f
        write(f, JSON.json(output_dict))
    end 
end

It would probably also be useful to have common save functions for common output types (CSV, tiff, etc.)

gottacatchenall commented 1 year ago

See #120