xanthos icon indicating copy to clipboard operation
xanthos copied to clipboard

Xanthos raises error when attempting to write outputs in .netcdf format

Open atmos-project opened this issue 2 years ago • 2 comments

Hello developers, I am new to Xanthos.

I have installed the package with no issues following the instructions provided. When I ran the example the first time, I kept the default assumptions then I got all outputs in .csv files. However, when I chose outputs to be in .netcdf format I had the following error (I had also some warnings prior to this error):

INFO: PET processed in 328.2244460582733 seconds--- INFO: Processing Runoff... INFO: Processing spin-up and simulation for basins 1...235 INFO: Runoff processed in 13.122142791748047 seconds--- INFO: Processing Routing... INFO: Routing processed in 447.40205478668213 seconds--- INFO: ---Simulation has finished successfully: 788.7534136772156 seconds --- INFO: ---Start Accessible Water: INFO: ---Accessible Water has finished successfully: 5.011179447174072 seconds ------ INFO: ---Start Drought Statistics: INFO: Calculating drought thresholds INFO: ---Drought Statistics has finished successfully: 0.6707887649536133 seconds ------ INFO: ---Start Hydropower Potential: C:\Users\atmos\Anaconda3\envs\earth-analytics-python\lib\site-packages\xanthos\hydropower\potential.py:36: FutureWarning: Support for multi-dimensional indexing (e.g. obj[:, None]) is deprecated and will be removed in a future version. Convert to a numpy array before indexing instead. e_grids = q_ex_h * hyd_grid_data["elevD"][:, np.newaxis] INFO: ---Hydropower Potential has finished successfully: 8.252254486083984 seconds ------ INFO: ---Start Hydropower Actual: INFO: ---Hydropower Actual has finished successfully: 62.43630385398865 seconds ------ INFO: ---Start Diagnostics: INFO: ---Diagnostics has finished successfully: 0.17566919326782227 seconds ------ INFO: ---Output simulation results: DEBUG: Outputting data annually DEBUG: Unit is km3peryear C:\Users\atmos\Anaconda3\envs\earth-analytics-python\lib\site-packages\pandas\core\indexing.py:719: FutureWarning: Slicing a positional slice with .loc is not supported, and will raise TypeError in a future version. Use .loc with labels or .iloc with positions instead. indexer = self._get_setitem_indexer(key) DEBUG: pet output dimension is (67420, 31) Traceback (most recent call last): File "C:\Users\atmos\Documents\xanthos\install_examples.py", line 25, in xanthos.run_model(config_file) File "C:\Users\atmos\Anaconda3\envs\earth-analytics-python\lib\site-packages\xanthos\model.py", line 121, in run_model xth.execute() File "C:\Users\atmos\Anaconda3\envs\earth-analytics-python\lib\site-packages\xanthos\model.py", line 94, in execute results = config_runner.run() File "C:\Users\atmos\Anaconda3\envs\earth-analytics-python\lib\site-packages\xanthos\configurations.py", line 136, in run c.output_simulation() File "C:\Users\atmos\Anaconda3\envs\earth-analytics-python\lib\site-packages\xanthos\components.py", line 459, in output_simulation output_writer.write() File "C:\Users\atmos\Anaconda3\envs\earth-analytics-python\lib\site-packages\xanthos\data_writer\out_writer.py", line 125, in write self.write_data(filename, var, self.outputs[i], col_names=self.time_steps) File "C:\Users\atmos\Anaconda3\envs\earth-analytics-python\lib\site-packages\xanthos\data_writer\out_writer.py", line 163, in write_data self.save_netcdf(filename, data, var) File "C:\Users\atmos\Anaconda3\envs\earth-analytics-python\lib\site-packages\xanthos\data_writer\out_writer.py", line 220, in save_netcdf griddata[:, :] = data[:, :].copy() File "C:\Users\atmos\Anaconda3\envs\earth-analytics-python\lib\site-packages\pandas\core\frame.py", line 3455, in getitem indexer = self.columns.get_loc(key) File "C:\Users\atmos\Anaconda3\envs\earth-analytics-python\lib\site-packages\pandas\core\indexes\base.py", line 3361, in get_loc return self._engine.get_loc(casted_key) File "pandas_libs\index.pyx", line 76, in pandas._libs.index.IndexEngine.get_loc File "pandas_libs\index.pyx", line 82, in pandas._libs.index.IndexEngine.get_loc TypeError: '(slice(None, None, None), slice(None, None, None))' is an invalid key

Thanks for any advice.

atmos-project avatar Jul 26 '21 21:07 atmos-project