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

sequence plot bedrock_surface_elevation #32

Closed
AHenryLarroze opened this issue Apr 6, 2022 · 3 comments
Closed

sequence plot bedrock_surface_elevation #32

AHenryLarroze opened this issue Apr 6, 2022 · 3 comments

Comments

@AHenryLarroze
Copy link

  • sequence version: 0.4.1.dev0
  • Python version: 3.7
  • Operating System: windows 10

Description

I was running the example as in the Readme. After running :
$ mkdir example
$ cd example && sequence setup
$ sequence run
I ran :
$ sequence plot
And I got an error message that the field bedrock_surface__elevation does not exist.

What I Did

(Sequence) C:\Users\ahenry01\example>sequence plot
Traceback (most recent call last):
  File "C:\Users\ahenry01\miniconda3\envs\Sequence\lib\site-packages\xarray\core\dataset.py", line 1395, in _construct_dataarray
    variable = self._variables[name]
KeyError: 'at_node:bedrock_surface__elevation'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ahenry01\miniconda3\envs\Sequence\Scripts\sequence-script.py", line 33, in <module>
    sys.exit(load_entry_point('sequence', 'console_scripts', 'sequence')())
  File "C:\Users\ahenry01\miniconda3\envs\Sequence\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\ahenry01\miniconda3\envs\Sequence\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Users\ahenry01\miniconda3\envs\Sequence\lib\site-packages\click\core.py", line 1289, in invoke
    rv.append(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\ahenry01\miniconda3\envs\Sequence\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\ahenry01\miniconda3\envs\Sequence\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\ahenry01\downloads\sequence-develop\sequence-develop\sequence\cli.py", line 320, in plot
    plot_strat(folder / "sequence.nc", **config)
  File "c:\users\ahenry01\downloads\sequence-develop\sequence-develop\sequence\plot.py", line 49, in plot_strat
    bedrock = ds["at_node:bedrock_surface__elevation"].data.squeeze()
  File "C:\Users\ahenry01\miniconda3\envs\Sequence\lib\site-packages\xarray\core\dataset.py", line 1499, in __getitem__
    return self._construct_dataarray(key)
  File "C:\Users\ahenry01\miniconda3\envs\Sequence\lib\site-packages\xarray\core\dataset.py", line 1398, in _construct_dataarray
    self._variables, name, self._level_coords, self.dims
  File "C:\Users\ahenry01\miniconda3\envs\Sequence\lib\site-packages\xarray\core\dataset.py", line 170, in _get_virtual_variable
    ref_var = variables[ref_name]
KeyError: 'at_node:bedrock_surface__elevation'
@mcflugen
Copy link
Collaborator

mcflugen commented Apr 6, 2022

👋 @Totadarck! Thank you for you detailed description of the issue you are having!

It looks like somewhere along the way the default set of input files (created by sequence setup) changed so as to create a Sequence simulation that produced an output file incompatible with the sequence plot command.

I will fix this properly but, in the meantime just to get you going, if you make the following changes to your sequence.toml file you should be able to plot stratigraphy.

The sequence.grid section should look like this,

[sequence.grid]
shape = [3, 100]
xy_spacing = 1000.0
xy_of_lower_left = [0.0, 0.0]

This increases the width of the profile from 10 km to 100 km. Without this change, the profile will be completely above water.

The sequence.output sections should look like the following,

[sequence.output]
interval = 10
filepath = "sequence.nc"
clobber = true
rows = [1]
fields = ["sediment_deposit__thickness", "bedrock_surface__elevation"]

This add the necessary bedrock_surface__elevation variable to the output file.

Additionally, you may want to increase the number of years your simulation is run for so that there is more sediment in your profile. You can do this in the sequence.clock section. For example, the following will run sequence for 200k years (rather than the default of 20k years),

[sequence.clock]
start = 0.0
stop = 200000.0
step = 100.0

@AHenryLarroze
Copy link
Author

@mcflugen Thank you for this quick and precise answer. It allowed me to see the output of the model.

@mcflugen
Copy link
Collaborator

mcflugen commented Apr 7, 2022

It allowed me to see the output of the model.

Wonderful! I'll also fix the underlying issue so that you don't have to edit the input file by hand.

@mcflugen mcflugen closed this as completed Apr 7, 2022
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