Conversation
rplzzz
left a comment
There was a problem hiding this comment.
The basic approach here looks sound, but it's failing one of its tests. What appears to be happening is that we are producing a tuple where a scalar value is expected:
Traceback (most recent call last):
File "/home/travis/build/JGCRI/xanthos/xanthos/test/test_equal_outputs.py", line 29, in testOutputs
res = xth.execute()
File "/home/travis/build/JGCRI/xanthos/xanthos/model.py", line 94, in execute
results = config_runner.run()
File "/home/travis/build/JGCRI/xanthos/xanthos/configurations.py", line 130, in run
c.hydropower_actual()
File "/home/travis/build/JGCRI/xanthos/xanthos/components.py", line 427, in hydropower_actual
HydropowerActual(self.s, self.Avg_ChFlow)
File "/home/travis/build/JGCRI/xanthos/xanthos/hydropower/actual.py", line 81, in __init__
self.hydro_sim()
File "/home/travis/build/JGCRI/xanthos/xanthos/hydropower/actual.py", line 183, in hydro_sim
self.init_sim()
File "/home/travis/build/JGCRI/xanthos/xanthos/hydropower/actual.py", line 125, in init_sim
self.q_states = self.inflow.groupby(self.inflow.index.month).quantile((0, 0.2375, 0.4750, 0.7125, 0.95, 1))
File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/pandas/core/groupby/groupby.py", line 1908, in quantile
interpolation=interpolation,
File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/pandas/core/groupby/groupby.py", line 2248, in _get_cythonized_result
func(**kwargs) # Call func to modify indexer values in place
File "pandas/_libs/groupby.pyx", line 692, in pandas._libs.groupby.group_quantile
TypeError: must be real number, not tuple
One thing that might prove useful in future developments along these lines: the ISIMIP files that we use contain a coordinate variable called time_bnds, which gives the start and end time of each time slice in the dataset. For determining the length of the months, time_bnds[:, 1] - time_bnds[:,0] is potentially more convenient than doing a bunch of calendrical calculations, and it avoids making assumptions about the type of calendar in use.
|
@crvernon It looks like you still have me marked as a reviewer on this PR. I'm guessing this is an oversight, though I'm happy to give you my thoughts if you want them. |
TASK:
Create a reader to ingest standard climate data formats in 3D [day, latitude, longitude] to the format and units required by Xanthos [land_cell, month].
COMPLETED:
pr,tas,tasmin,tasmaxUSAGE:
To save formatted outputs as datasets: