Skip to content

Commit

Permalink
new co2 tests run
Browse files Browse the repository at this point in the history
  • Loading branch information
ledm committed Mar 28, 2024
1 parent 460e199 commit 0dc82e0
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bgcval2/timeseries/timeseriesTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,9 @@ def save_csv(
filename = bvt.folder(csvFolder) + '_'.join([analysisname, name, region, layer, metric, ts ]) + csvformat

jsondata = {
'timesD': timesD,
'arrD': arrD,
# json can't save numpy.float32, so we convert to list of floats.
'timesD': {job:[float(t) for t in times] for job, times in timesD.items()},
'arrD': {job:[float(d) for d in data] for job, data in arrD.items()},
'analysisname': analysisname,
'colours':colours,
'linestyles':linestyles,
Expand All @@ -305,17 +306,18 @@ def save_csv(
}

if os.path.exists(filename):
print('Opening old file:', filename)
with open(filename) as json_data:
json_old = json.load(json_data)

diff = jsondiff(jsondata, json_old)
if not len(diff):
print('Nothing new to add', filename)
print('Nothing new to add')
return

print('Data saved in: ', filename)
with open(filename, 'w', encoding='utf-8') as f:
json.dump(jsondata, f, ensure_ascii=False, indent=4)
print('Data saved in: ', filename)


class DataLoader:
Expand Down
68 changes: 68 additions & 0 deletions input_yml/TerraFIRMA_overshoot_co2tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
name: TerraFIRMA_overshoot_co2tests

# Run the single job analysis
do_analysis_timeseries: True

# Download from mass:
do_mass_download: False

# master analysis suite
master_suites: physics bgc #alkalinity physics kmf1

clean: True

# Output the figures as csv json files.
savecsv: True

jobs:
u-ca306:
description: 'Reference '
label: PiControl
colour: 'blue'
thickness: 0.6
linestyle: '-'
shifttime: 0.
timerange: [1850, 2020]
suite: kmf physics bgc #alkalinity physics

u-cz014:
description: 'Terrafirma 4x CO2'
label: '4xCO2'
colour: 'green'
thickness: 1.7
linestyle: '-'
shifttime: 0.
suite: kmf physics bgc #alkalinity physics

u-cz014:
description: 'Terrafirma 1% CO2'
label: '1%CO2'
colour: 'purple'
thickness: 1.7
linestyle: '-'
shifttime: 0.
suite: kmf physics bgc #alkalinity physics


u-cy623:
description: 'interactive ice, started from picontrol yr 2277'
label: 'hist ice'
colour: 'orange'
thickness: 1.7
linestyle: 'dashdot'
shifttime: 0.
suite: kmf physics bgc #alkalinity physics


u-cy690:
description: 'static ice sheets, started from picontrol yr 2277'
colour: 'red'
label: 'hist static ice'
thickness: 1.7
linestyle: ':'
shifttime: 0.
suite: kmf physics bgc #alkalinity physics



0 comments on commit 0dc82e0

Please sign in to comment.