def test_constraint_forcing(): forcing_csv = os.path.join(path, "data/MAGICC_RF_4.5.csv") forcing = read_hector_constraint(forcing_csv) output = pyhector.run(rcp45, {"forcing": {"Ftot_constrain": forcing}}) assert_series_equal( output["forcing.Ftot"].loc[1765:2300], forcing.loc[1765:2300], check_names=False )
def test_constraint_forcing(): forcing_csv = os.path.join(path, "data/MAGICC_RF_4.5.csv") forcing = read_hector_constraint(forcing_csv) output = pyhector.run(rcp45, {"temperature": {"tgav_constrain": forcing}}) # Simplifying the overlapping date-range (later lawdome values are yearly.) assert_series_equal(output["temperature.Tgav"].loc[1765:2300], forcing.loc[1765:2300], check_names=False)
def test_constraint_co2(): lawdome_co2_csv = os.path.join(path, "data/lawdome_co2.csv") lawdome_co2 = read_hector_constraint(lawdome_co2_csv) output = pyhector.run(rcp45, {"simpleNbox": {"Ca_constrain": lawdome_co2}}) # Simplifying the overlapping date-range (later CO2 values are yearly.) assert_series_equal(output["simpleNbox.Ca"].loc[1750:1960:5], lawdome_co2.loc[1750:1960], check_names=False)
def test_constraint_temperature(): temperature_csv = os.path.join(path, "data/tgav_historical.csv") tgav = read_hector_constraint(temperature_csv) output = pyhector.run(rcp45, {"temperature": {"tgav_constrain": tgav}}) # Simplifying the overlapping date-range (later lawdome values are yearly.) assert_series_equal(output["temperature.Tgav"].loc[1850:2013], tgav.loc[1850:2013], check_names=False)
def test_reading_constraint_file(): lawdome_co2_csv = os.path.join(path, "data/lawdome_co2.csv") lawdome = read_hector_constraint(lawdome_co2_csv) assert lawdome.loc[1010] == 279.5 assert lawdome.loc[2008] == 385.34