Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reservoir Output Data Not Generated #171

Open
Nooshdokht-Bayatafshary opened this issue Sep 15, 2024 · 3 comments
Open

Reservoir Output Data Not Generated #171

Nooshdokht-Bayatafshary opened this issue Sep 15, 2024 · 3 comments

Comments

@Nooshdokht-Bayatafshary

Dear @StefaniaGrimaldi,

I am currently running LISFLOOD for a basin that contains one reservoir. In my configuration, I have specified the necessary keys in the XML file (Settings.zip) to export reservoir outputs such as inflow and outflow. However, these outputs are not being generated as expected.

<setoption choice="1" name="simulateReservoirs"/>
<setoption choice="1" name="repsimulateReservoirs"/>

I’ve double-checked the XML setup, but I’m unsure what might be causing this issue. I’ve attached my setup data for the basin for further inspection (data).

Could you please advise on what might be going wrong or if there are any additional steps required to enable reservoir output generation?

Thank you for your time and assistance!

Best regards,
Nooshdokht

@StefaniaGrimaldi
Copy link
Contributor

StefaniaGrimaldi commented Sep 15, 2024

Dear @Nooshdokht-Bayatafshary,

thank you for your enquiry.

The option "repsimulateReservoirs" allows to print the time series (.tss format) of the level of filling, inflow, and outflow for each reservoir included in the computational domain (

'ReservoirFillTS': TimeSeries(name='ReservoirFillTS', output_var='ReservoirFill',
,
'ReservoirInflowTS': TimeSeries(name='ReservoirInflowTS', output_var='ReservoirInflowM3S',
,
'ReservoirOutflowTS': TimeSeries(name='ReservoirOutflowTS', output_var='ReservoirOutflowM3S',
).

In the xml file "settings_calibration_daily2001Runlong_term_run.xml", "repsimulateReservoirs" is set to 1 in line 72, but then to 0 in line 87 (this latter setting switches off the printing function). Could you please confirm that I am looking at the correct xml file?

In case you wished to print netcdf gridded outputs of the level of filling of reservoirs, you would need to activate "repStateMaps". Inflow and outflows in netcdf gridded format can be extracted from dis.nc ("repDischargeMaps").

I hope that this answer helps,
kind regards,
Stefania

@Nooshdokht-Bayatafshary
Copy link
Author

Dear @StefaniaGrimaldi,

Thank you for your detailed response. You were absolutely right—the issue was caused by the conflicting setting in the XML file. I removed the second occurrence of repsimulateReservoirs in line 87, as you suggested. However, I am now encountering a new error:

Traceback (most recent call last):
  File "/home/n.bayatafshary74.student.sharif/.conda/envs/lis3.8/bin/lisflood", line 41, in <module>
    sys.exit(main())
  File "/home/n.bayatafshary74.student.sharif/.conda/envs/lis3.8/lib/python3.8/site-packages/lisflood/main.py", line 226, in main
    lisfloodexe(lissettings)
  File "/home/n.bayatafshary74.student.sharif/.conda/envs/lis3.8/lib/python3.8/site-packages/lisflood/main.py", line 90, in lisfloodexe
    Lisflood = LisfloodModel()
  File "/home/n.bayatafshary74.student.sharif/.conda/envs/lis3.8/lib/python3.8/site-packages/lisflood/Lisflood_initial.py", line 236, in __init__
    self.output_module.initial()
  File "/home/n.bayatafshary74.student.sharif/.conda/envs/lis3.8/lib/python3.8/site-packages/lisflood/global_modules/output.py", line 535, in initial
    self.var.Tss[tss] = TimeoutputTimeseries(str(binding[tss]), self.var, outpoints, noHeader=flags['noheader'])
  File "/home/n.bayatafshary74.student.sharif/.conda/envs/lis3.8/lib/python3.8/site-packages/lisflood/global_modules/zusatz.py", line 374, in __init__
    outlet_idx = np.where(codesId == outlet_code)[0][0]
IndexError: index 0 is out of bounds for axis 0 with size 0

It seems to be related to the ReservoirFillTS key based on the output when I printed binding[tss]. I'm not quite sure what’s causing the problem. Could you kindly help me troubleshoot this?

Thanks again for your assistance!

Best regards,
Nooshdokht

@StefaniaGrimaldi
Copy link
Contributor

StefaniaGrimaldi commented Oct 8, 2024

Dear @Nooshdokht-Bayatafshary,

I am sorry for the delay. @doc78 and I finally found some time to explore your issue.

The problem is a consequence of missing metadata in your input netcdf maps (e.g. res.nc).

Specifically, the function that writes .tss files crashes because missing_value is not set. This explains the error when you activate repsimulateReservoirs.
Furthermore, output files in netcdf format are regularly written but they do not have any reference system.

To solve the issue, you need to set the metadata in your input maps, particularly important are
missing_value, _FillValue, and reference system.

We hope that this message helps,
we are at your disposal for further discussions,
kind regards,
Carlo and Stefania

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants