Ouranosinc / PAVICS-landing

The landing page serving as the entrance to PAVICS
1 stars 0 forks source link

update notebook output for Jenkins failure #57

Closed tlvu closed 1 year ago

tlvu commented 1 year ago

Passed Jenkins build:

http://jenkins.ouranos.ca/job/PAVICS-e2e-workflow-tests/job/current-production-version/98/console

12:51:32  ============================= test session starts ==============================
12:51:32  platform linux -- Python 3.8.15, pytest-7.2.0, pluggy-1.0.0
12:51:32  rootdir: /home/jenkins/agent/workspace/tests_current-production-version
12:51:32  plugins: anyio-3.6.2, dash-2.7.0, nbval-0.9.6, tornasync-0.6.0.post2
12:51:32  collected 39 items
12:51:32  
12:51:33  PAVICS-landing-fix-broken-jenkins/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-1DataAccess.ipynb . [  2%]
12:51:37  ......                                                                   [ 17%]
12:51:59  PAVICS-landing-fix-broken-jenkins/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-2Subsetting.ipynb . [ 20%]
12:52:13  .............                                                            [ 53%]
12:52:23  PAVICS-landing-fix-broken-jenkins/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-3Climate-Indicators.ipynb . [ 56%]
12:52:56  ....s.                                                                   [ 71%]
12:53:04  PAVICS-landing-fix-broken-jenkins/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-4Ensembles.ipynb . [ 74%]
12:53:08  ...                                                                      [ 82%]
12:53:23  PAVICS-landing-fix-broken-jenkins/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-5Visualization.ipynb . [ 84%]
12:53:51  ......                                                                   [100%]
12:53:51  
12:53:51  ================== 38 passed, 1 skipped in 137.90s (0:02:17) ===================

To fix the following Jenkins failure:

  _ PAVICS-landing-master/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-2Subsetting.ipynb::Cell 0 _
  Notebook cell execution failed
  Cell 0: Cell outputs differ

  Input:
  import warnings

  import xarray as xr
  from IPython.display import display  # Fancy representation of xarray objects
  from siphon.catalog import TDSCatalog

  warnings.simplefilter("ignore")
  url = "https://pavics.ouranos.ca/twitcher/ows/proxy/thredds/catalog/datasets/simulations/bias_adjusted/cmip5/ouranos/cb-oura-1.0/catalog.xml"  # TEST_USE_PROD_DATA

  # Create Catalog
  cat = TDSCatalog(url)

  # DAP link for this demo
  ds_url = cat.datasets[0].access_urls["OPENDAP"]

  # xarray.Dataset
  ds = xr.open_dataset(ds_url, chunks=dict(time=256 * 2, lon=32, lat=32))
  display(ds)
  a = ds.tasmin.isel(time=0).plot(figsize=(10, 4))

  Traceback:
   mismatch 'text/plain'

   assert reference_output == test_output failed:

    '<xarray.Data...id:       NCC' == '<xarray.Data...id:       NCC'
    Skipping 957 identical leading characters in diff, use -v to show
    -   driving_experiment:         historical,rcp85
    +   driving_model:              NorESM1-M
          ...                         ...
          frequency:                  day
          modeling_realm:             atmos
          target_dataset:             CANADA : ANUSPLIN interpolated Canada daily 3...
          target_dataset_references:  CANADA : https://doi.org/10.1175/2011BAMS3132...
          driving_institution:        Norwegian Climate Centre
          driving_institute_id:       NCC

  _ PAVICS-landing-master/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-2Subsetting.ipynb::Cell 1 _
  Notebook cell execution failed
  Cell 1: Cell outputs differ

  Input:
  from clisops.core import subset

  lon = [-75.4, -85, -65.5]  # Longitude
  lat = [46.67, 41, 55.3]  # Latitude

  ds_gridpoint = subset.subset_gridpoint(ds, lon=lon, lat=lat)
  display(ds_gridpoint)

  # Plot first year of tasmax data
  a = ds_gridpoint.tasmax.isel(time=slice(0, 365)).plot.line(x="time", figsize=(10, 4))

  Traceback:
   mismatch 'text/plain'

   assert reference_output == test_output failed:

    '<xarray.Data...id:       NCC' == '<xarray.Data...id:       NCC'
    Skipping 892 identical leading characters in diff, use -v to show
    -   driving_experiment:         historical,rcp85
    +   driving_model:              NorESM1-M
          ...                         ...
          frequency:                  day
          modeling_realm:             atmos
          target_dataset:             CANADA : ANUSPLIN interpolated Canada daily 3...
          target_dataset_references:  CANADA : https://doi.org/10.1175/2011BAMS3132...
          driving_institution:        Norwegian Climate Centre
          driving_institute_id:       NCC

  _ PAVICS-landing-master/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-2Subsetting.ipynb::Cell 3 _
  Notebook cell execution failed
  Cell 3: Cell outputs differ

  Input:
  # Specify the longitude and latitude boundaries
  lon_bnds = [-80.5, -60.2]
  lat_bnds = [44, 55]

  ds1 = subset.subset_bbox(ds, lon_bnds=lon_bnds, lat_bnds=lat_bnds)
  display(ds1)

  # Plot a map of first timestep
  a = ds1.tasmax.isel(time=0).plot()

  Traceback:
   mismatch 'text/plain'

   assert reference_output == test_output failed:

    '<xarray.Data...id:       NCC' == '<xarray.Data...id:       NCC'
    Skipping 955 identical leading characters in diff, use -v to show
    -   driving_experiment:         historical,rcp85
    +   driving_model:              NorESM1-M
          ...                         ...
          frequency:                  day
          modeling_realm:             atmos
          target_dataset:             CANADA : ANUSPLIN interpolated Canada daily 3...
          target_dataset_references:  CANADA : https://doi.org/10.1175/2011BAMS3132...
          driving_institution:        Norwegian Climate Centre
          driving_institute_id:       NCC

  _ PAVICS-landing-master/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-3Climate-Indicators.ipynb::Cell 0 _
  Notebook cell execution failed
  Cell 0: Cell outputs differ

  Input:
  import warnings

  import geopandas as gpd
  import matplotlib.pyplot as plt
  import xarray as xr
  from clisops.core import subset
  from dask.diagnostics import ProgressBar
  from siphon.catalog import TDSCatalog
  from xclim import atmos

  warnings.simplefilter("ignore")
  # TODO change address
  url = "https://pavics.ouranos.ca/twitcher/ows/proxy/thredds/catalog/datasets/simulations/bias_adjusted/cmip5/ouranos/cb-oura-1.0/catalog.xml"  # TEST_USE_PROD_DATA

  # Create Catalog
  cat = TDSCatalog(url)

  # Subset over the Gasp�� peninsula in eastern Quebec
  gaspe = gpd.GeoDataFrame.from_file(
      "/notebook_dir/pavics-homepage/tutorial_data/gaspesie_mrc.geojson"
  )
  ds = subset.subset_shape(
      xr.open_dataset(cat.datasets[0].access_urls["OPENDAP"], chunks=dict(time=256)),
      shape=gpd.GeoDataFrame(geometry=gaspe.buffer(0.05)),
  )

  # What we see here is only a representation of the full content, the entire data set hasn't been loaded.
  display(ds)

  # plot of single day tasmin
  a = ds.tasmin.isel(time=0).plot(figsize=(10, 4))

  Traceback:
   mismatch 'text/plain'

   assert reference_output == test_output failed:

    '<xarray.Data...    EPSG:4326' == '<xarray.Data...    EPSG:4326'
    Skipping 975 identical leading characters in diff, use -v to show
    -   driving_experiment:         historical,rcp85
    +   driving_model:              NorESM1-M
          ...                         ...
          modeling_realm:             atmos
          target_dataset:             CANADA : ANUSPLIN interpolated Canada daily 3...
          target_dataset_references:  CANADA : https://doi.org/10.1175/2011BAMS3132...
          driving_institution:        Norwegian Climate Centre
          driving_institute_id:       NCC
          crs:                        EPSG:4326
review-notebook-app[bot] commented 1 year ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

tlvu commented 1 year ago

LGTM... don't know why precommit check is failing

@Zeitsperre Does it means the regex is missing <>= ?

    stderr:
          error: subprocess-exited-with-error

          × Preparing metadata (pyproject.toml) did not run successfully.
          │ exit code: 1
          ╰─> [17 lines of output]
              Traceback (most recent call last):
                File "/pc/clone/tlXngWg1Q22J-O_IAQZnTQ/py_env-python3/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
                  main()
                File "/pc/clone/tlXngWg1Q22J-O_IAQZnTQ/py_env-python3/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
                  json_out['return_val'] = hook(**hook_input['kwargs'])
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/pc/clone/tlXngWg1Q22J-O_IAQZnTQ/py_env-python3/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
                  return hook(metadata_directory, config_settings)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/tmp/pip-build-env-o930eag7/overlay/lib/python3.11/site-packages/poetry/core/masonry/api.py", line 40, in prepare_metadata_for_build_wheel
                  poetry = Factory().create_poetry(Path(".").resolve(), with_groups=False)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/tmp/pip-build-env-o930eag7/overlay/lib/python3.11/site-packages/poetry/core/factory.py", line 57, in create_poetry
                  raise RuntimeError("The Poetry configuration is invalid:\n" + message)
              RuntimeError: The Poetry configuration is invalid:
                - [extras.pipfile_deprecated_finder.2] 'pip-shims<=0.3.4' does not match '^[a-zA-Z-_.0-9]+$'
tlvu commented 1 year ago

This is odd, I do not see any regex in https://github.com/Ouranosinc/PAVICS-landing/blob/master/.pre-commit-config.yaml

tlvu commented 1 year ago

Merged anyways to fix Jenkins in production and since my change is completely unrelated to the pre-commit hook failure.