-
Notifications
You must be signed in to change notification settings - Fork 2
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
CaSR_basic.ipynb: fix output to avoid breaking Jenkins #323
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refresh using current production Jenkins env. Fix this error: ``` [2024-03-16T00:52:45.909Z] _______ pavics-sdi-master/docs/source/notebooks/CaSR_basic.ipynb::Cell 2 _______ [2024-03-16T00:52:45.909Z] [91mNotebook cell execution failed[0m [2024-03-16T00:52:45.909Z] [94mCell 2: Cell outputs differ [2024-03-16T00:52:45.909Z] [2024-03-16T00:52:45.909Z] Input: [2024-03-16T00:52:45.909Z] [0mimport logging [2024-03-16T00:52:45.909Z] [2024-03-16T00:52:45.909Z] from dask.distributed import Client [2024-03-16T00:52:45.909Z] from IPython.display import clear_output [2024-03-16T00:52:45.909Z] [2024-03-16T00:52:45.909Z] # For hourly data, we suggest using the following chunking pattern: dict(time=720, rlon=50, rlat=50) [2024-03-16T00:52:45.909Z] # Compute 10-year precipitation means. This is a lazy operation, no computations are done at this point. [2024-03-16T00:52:45.909Z] pr10y = bbox.pr.resample(time="10YS").mean(dim="time", keep_attrs=True) [2024-03-16T00:52:45.909Z] [2024-03-16T00:52:45.909Z] # Options for dask workers [2024-03-16T00:52:45.909Z] dask_kwargs = dict( [2024-03-16T00:52:45.909Z] n_workers=8, [2024-03-16T00:52:45.909Z] threads_per_worker=6, [2024-03-16T00:52:45.909Z] memory_limit="2.5GB", [2024-03-16T00:52:45.909Z] local_directory="/notebook_dir/writable-workspace/tmp", [2024-03-16T00:52:45.909Z] silence_logs=logging.ERROR, [2024-03-16T00:52:45.909Z] ) [2024-03-16T00:52:45.909Z] [2024-03-16T00:52:45.909Z] # Actually perform the computation [2024-03-16T00:52:45.909Z] with Client(**dask_kwargs) as c: [2024-03-16T00:52:45.909Z] clear_output() [2024-03-16T00:52:45.909Z] # Just taking the first 10-year average to speed things up [2024-03-16T00:52:45.909Z] pr10y = pr10y.isel(time=0).compute() [2024-03-16T00:52:45.909Z] clear_output() [2024-03-16T00:52:45.909Z] pr10y.plot() [2024-03-16T00:52:45.909Z] [2024-03-16T00:52:45.909Z] [94mTraceback:[0m [2024-03-16T00:52:45.909Z] [91mUnexpected output fields from running code: {'stderr'}[0m [2024-03-16T00:52:45.909Z] [2024-03-16T00:52:45.909Z] ----------------------------- Captured stdout call ----------------------------- [2024-03-16T00:52:45.909Z] unhandled iopub msg: clear_output [2024-03-16T00:52:45.909Z] unhandled iopub msg: clear_output [2024-03-16T00:52:45.909Z] _______ pavics-sdi-master/docs/source/notebooks/CaSR_basic.ipynb::Cell 3 _______ [2024-03-16T00:52:45.909Z] [91mNotebook cell execution failed[0m [2024-03-16T00:52:45.909Z] [94mCell 3: Cell outputs differ [2024-03-16T00:52:45.909Z] [2024-03-16T00:52:45.909Z] Input: [2024-03-16T00:52:45.909Z] [0mfrom xclim import atmos [2024-03-16T00:52:45.909Z] [2024-03-16T00:52:45.909Z] # Compute heat index using xclim and find the annual maxima. [2024-03-16T00:52:45.909Z] with Client(**dask_kwargs) as c: [2024-03-16T00:52:45.909Z] clear_output() [2024-03-16T00:52:45.909Z] hi_max = atmos.heat_index(ds=site).resample(time="Y").max() [2024-03-16T00:52:45.909Z] clear_output() [2024-03-16T00:52:45.909Z] [2024-03-16T00:52:45.909Z] # Plot the results [2024-03-16T00:52:45.909Z] hi_max.plot() [2024-03-16T00:52:45.909Z] [2024-03-16T00:52:45.909Z] [94mTraceback:[0m [2024-03-16T00:52:45.909Z] [91mUnexpected output fields from running code: {'stderr'}[0m [2024-03-16T00:52:45.909Z] [2024-03-16T00:52:45.909Z] ----------------------------- Captured stdout call ----------------------------- [2024-03-16T00:52:45.909Z] unhandled iopub msg: clear_output [2024-03-16T00:52:45.909Z] unhandled iopub msg: clear_output ```
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
for more information, see https://pre-commit.ci
huard
approved these changes
Mar 18, 2024
Finally have to add |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add
# NBVAL_IGNORE_OUTPUT
to pass Jenkins. I think it's probably due to the usage ofclear_output()
. However removingclear_output()
will make the output very long and messy. Have to take the lesser of the 2 evils.New notebook introduced by #320.
Fix this error: