import spacegrids as sg import numpy as np import matplotlib.pyplot as plt import os figsize(8,4) D = sg.info() P = sg.project(D['DP']) for c in P['GM_C_flat'].axes: exec c.name + ' = c' ls /home/wim/PROJECTS/DP4/GM_C_flat/ $ tail control.in &hlmix / &isopyc slmx=0.01, ahisop=4.e6, athkdf=4.e6, del_dm=0.4e-02, s_dm=0.1e-2 / &ppmix / &smagnl / &adv_q diffactor=50. / &co2 co2ccn=280. / &paleo pyear=1850. / &ice dampice=5., ice_yr=1850. / &veg crops_yr=1850. / &mtlm TIMESTEP=3600., INT_VEG=.true., VEG_EQUIL=.false. / $ P.load('temp') P.insert(sg.read_control_func('control.in')) # read, parse and insert parameters from control.in P['GM_C_flat'].params['co2ccn'] # obtain the value of the 'co2ccn' param bigfield_DP = P.param2gr('co2ccn' , lambda x:x['temp'], 'DP*') # do this for the DP type bigfield_GM = P.param2gr('co2ccn', lambda x:x['temp'], 'GM*') # do this for the GM type bigfield_DP.gr bigfield_DP.gr[0][:] h1, = sg.plot(bigfield_DP[Z,17:]/(X*Y*Z) + sg.zero_kelvin) h2, = sg.plot(bigfield_GM[Z,17:]/(X*Y*Z) + sg.zero_kelvin) lbl = plt.ylabel('C') lbl = plt.xlabel('co2 ccn') tle = plt.title('Bottom ocean temperature for DP open and closed') lgnd = plt.legend([h1,h2],["DP closed","DP open"],loc=2) plt.grid() regexp = '[\w_]+_(\d+)ppm[\w_]+' P.insert(sg.parse_fname_func(regexp,parname='co2')) [E.params['co2'] for E in P.expers.values() if 'DP' in E.name ] P.insert(sg.parse_fname_func(regexp,parname='co2', nomatch_fill = '280ppm')) [E.params['co2'] for E in P.expers.values() if 'DP' in E.name ] big_field_DP = P.param2gr('co2' , lambda x:x['temp'], name_filter = 'DP*') h1, = sg.plot(bigfield_DP[Z,17:]/(X*Y*Z) + sg.zero_kelvin) lbl = plt.ylabel('C') lbl = plt.xlabel('co2 ccn') bigfield_DP=P.pattern2gr(fld_name = 'temp',pattern = regexp,parname='co2', name_filter = 'DP*', nomatch_fill = 280.) bigfield_DP.gr[0][:]