Closed chrisroadmap closed 7 months ago
that whole code block is re-factoring potential gold.
I can reproduce the error with the below (make a species_configs csv, delete all rows except ch4, so that aci not included)
from fair import FAIR
from fair.io import read_properties
f = FAIR()
f.define_time(2000, 2050, 1)
f.define_configs(["high", "central", "low"])
f.define_scenarios(["abrupt", "ramp"])
species, properties = read_properties('species_configs_properties_ch4.csv')
f.define_species(species, properties)
f.allocate()
f.fill_species_configs('species_configs_properties_ch4.csv') # this line should fail
ValueError: could not broadcast input array from shape (0,) into shape (3,)
these lines here may need an if function to check whether aci and ch4 are included before trying to fill them
https://github.com/OMS-NetZero/FAIR/blob/c09bee83c7f2c43a32f1978b15fb5cbbc5f5cf87/src/fair/fair.py#L717C1-L724C10
This arises when
f.fill_species_configs(FILE)
takes a CSV file as input and the ch4 or aci species types are not defined in the problem.Raises this error:
ValueError: could not broadcast input array from shape (0,) into shape (1,)