Ouranosinc / PAVICS-landing

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

Output diff in DACCS CI tests #92

Closed fmigneault closed 4 months ago

fmigneault commented 4 months ago

As seen in https://github.com/bird-house/birdhouse-deploy/pull/460#issuecomment-2149072290 (http://daccs-jenkins.crim.ca/job/PAVICS-e2e-workflow-tests/job/master/1625/console)

03:25:30  =================================== FAILURES ===================================
03:25:30  _ PAVICS-landing-master/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-5Visualization.ipynb::Cell 1 _
03:25:30  Notebook cell execution failed
03:25:30  Cell 1: Cell outputs differ
03:25:30  
03:25:30  Input:
03:25:30  ##
03:25:30  bokeh.io.output_notebook()
03:25:30  from bokeh.resources import settings
03:25:30  
03:25:30  settings.resources = "inline"
03:25:30  
03:25:30  logging.getLogger().disabled = True
03:25:30  warnings.simplefilter("ignore")
03:25:30  pn.extension()
03:25:30  
03:25:30  
03:25:30  output = "/notebook_dir/writable-workspace/tmp/tutorial3/output"
03:25:30  infolder = Path(output)
03:25:30  ds_all = []
03:25:30  for scen in ["ssp245", "ssp370"]:
03:25:30      ds_vars = []
03:25:30      for v in ["tx_mean", "tx_days_above_27"]:
03:25:30          for f in ["seasonal", "annual"]:
03:25:30              # create a list of datasets for which the time dimension has been "unstacked"
03:25:30              ncfiles = [
03:25:30                  xs.utils.unstack_dates(xr.open_dataset(d, decode_timedelta=False))
03:25:30                  for d in infolder.glob(f"{v}*{f}*{scen}*.nc")
03:25:30              ]
03:25:30  
03:25:30              # Create an ensemble dataset from the simulations for the given SSP
03:25:30              # Add a new scen dimension and corodinate
03:25:30              ds_vars.append(
03:25:30                  xens.create_ensemble(ncfiles, calendar="standard").expand_dims(
03:25:30                      scen=[scen]
03:25:30                  )
03:25:30              )
03:25:30      # Create a single dataset with both variables
03:25:30      ds_all.append(xr.merge(ds_vars))
03:25:30  
03:25:30  # concatenate the 2 SSP datasets together along the new 'scen' dim
03:25:30  ds_ens = xr.concat(ds_all, dim="scen")
03:25:30  ds_ens = ds_ens.sel(time=slice("1981", "2100"))  # select years 1971-2100
03:25:30  
03:25:30  # It is usually more intuitive to visualize temperature in Celsius
03:25:30  for v in ds_ens.data_vars:
03:25:30      if units.units2pint(ds_ens[v]) == "kelvin":
03:25:30          ds_ens[v] = units.convert_units_to(ds_ens[v], "degC")
03:25:30  
03:25:30  # rearrange season order to something more logical
03:25:30  ds_ens = ds_ens.sel(season=["annual", "DJF", "MAM", "JJA", "SON"])
03:25:30  
03:25:30  ds_ens
03:25:30  
03:25:30  Traceback:
03:25:30  Missing output fields from running code: {'application/vnd.holoviews_exec.v0+json'}
03:25:30  
03:25:30  _ PAVICS-landing-master/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-6Regridding_Conversion.ipynb::Cell 1 _
03:25:30  Notebook cell execution failed
03:25:30  Cell 1: Cell outputs differ
03:25:30  
03:25:30  Input:
03:25:30  #
03:25:30  bokeh.io.output_notebook()
03:25:30  from bokeh.resources import settings
03:25:30  
03:25:30  settings.resources = "inline"
03:25:30  
03:25:30  logging.getLogger().disabled = True
03:25:30  warnings.simplefilter("ignore")
03:25:30  pn.extension()
03:25:30  #
03:25:30  
03:25:30  ncfile = Path(
03:25:30      "/notebook_dir/writable-workspace/tmp/tutorial5/output/Gaspesie_ESPO-G6-R2_30yAvg_ensemble_percentiles.nc"
03:25:30  )
03:25:30  ds30yAvg_ensfill = xr.open_dataset(ncfile, chunks={}, decode_timedelta=False)
03:25:30  ds30yAvg_ensfill = ds30yAvg_ensfill.assign_coords(
03:25:30      **xs.regrid.create_bounds_rotated_pole(ds30yAvg_ensfill)
03:25:30  )
03:25:30  
03:25:30  # compare regridded to original
03:25:30  rotp = ccrs.RotatedPole(
03:25:30      pole_longitude=ds30yAvg_ensfill.rotated_pole.grid_north_pole_longitude,
03:25:30      pole_latitude=ds30yAvg_ensfill.rotated_pole.grid_north_pole_latitude,
03:25:30  )
03:25:30  ## create a mask using the extent of the data itself
03:25:30  dict_sel = dict(time="2071", scen="ssp245", season="annual", percentiles=50)
03:25:30  ds30yAvg_ensfill["mask"] = ~np.isnan(ds30yAvg_ensfill.tx_mean.sel(dict_sel).squeeze())
03:25:30  
03:25:30  # create the output target grid
03:25:30  cell_res = 0.1
03:25:30  lon0, lon1 = (
03:25:30      ds30yAvg_ensfill.lon.min().values - cell_res,
03:25:30      ds30yAvg_ensfill.lon.max().values + cell_res,
03:25:30  )
03:25:30  lat0, lat1 = (
03:25:30      ds30yAvg_ensfill.lat.min().values - cell_res,
03:25:30      ds30yAvg_ensfill.lat.max().values + cell_res,
03:25:30  )
03:25:30  outgrid = xe.util.cf_grid_2d(lon0, lon1, cell_res, lat0, lat1, cell_res)
03:25:30  
03:25:30  # Create xesmf regridder object
03:25:30  regridder = xe.Regridder(
03:25:30      ds30yAvg_ensfill, outgrid, "conservative_normed", unmapped_to_nan=True
03:25:30  )
03:25:30  # Apply regridding
03:25:30  ds30yAvg_ensregrid = regridder(ds30yAvg_ensfill)
03:25:30  
03:25:30  # compare
03:25:30  pn.Row(
03:25:30      ds30yAvg_ensfill.sel(dict_sel).tx_days_above_27.hvplot.quadmesh(
03:25:30          title="Original : Rotated pole",
03:25:30          x="rlon",
03:25:30          y="rlat",
03:25:30          crs=rotp,
03:25:30          geo=True,
03:25:30          cmap="spectral_r",
03:25:30          tiles="EsriImagery",
03:25:30          alpha=0.95,
03:25:30      )
03:25:30      + ds30yAvg_ensregrid.sel(dict_sel).tx_days_above_27.hvplot.quadmesh(
03:25:30          title="Regridded : Regular lon/lat",
03:25:30          x="lon",
03:25:30          y="lat",
03:25:30          geo=True,
03:25:30          xlim=[-68, -63.5],
03:25:30          cmap="spectral_r",
03:25:30          tiles="EsriImagery",
03:25:30          alpha=0.95,
03:25:30      )
03:25:30  )
03:25:30  
03:25:30  Traceback:
03:25:30   mismatch 'application/vnd.bokehjs_load.v0+json'
03:25:30  
03:25:30   assert reference_output == test_output failed:
03:25:30  
03:25:30    "'use strict'...\n}(window));" == "'use strict'...\n}(window));"
03:25:30    
03:25:30    Skipping 1109 identical leading characters in diff, use -v to show
03:25:30    Skipping 403 identical trailing characters in diff, use -v to show
03:25:30    - mentById("cbef2947-b8dc-4f3e-9d19-02d8f11ea9e4");
03:25:30    + mentById("a267c85f-8295-4657-a1f1-6e42ef791601");
03:25:30          if (el != null) {
03:25:30            const html = (() => {
03:25:30              if (typeof root.Bokeh === "undefined") {
03:25:30                if (error == null) {
03:25:30                  return "BokehJS is loading ...";
03:25:30                } else {
03:25:30                  return "BokehJS failed to load.";
03:25:30                }
03:25:30              } else {
03:25:30                const prefix = `BokehJS ${root.Bokeh.version}`;
03:25:30                if (error == null) {
03:25:30                  return `${prefix} successfully loaded.`;
03:25:30                } else {
03:25:30                  return `${prefix} <b>encountered errors</b> while loading and may not function as expected.`;
03:25:30                }
03:25:30              }
03:25:30            })();
03:25:30            el.innerHTML = html;
03:25:30      
03:25:30            if (error != null) {
03:25:30              const wrapper = document.createElement("div");
03:25:30              wrapper.style.overflow = "auto";
03:25:30              wrapper.style.height = "5em";
03:25:30              wrapper.style.resize = "vertical";
03:25:30              const content = document.createElement("div");
03:25:30              content.style.fontFamily = "monospace";
03:25:30              content.style.whiteSpace = "pre-wrap";
03:25:30              content.style.backgroundColor = "rgb(255, 221, 221)";
03:25:30              content.textContent = error.stack ?? error.toString();
03:25:30              wrapper.append(content);
03:25:30              el.append(wrapper);
03:25:30            }
03:25:30          } else if (Date.now() < root._bokeh_timeout) {
03:25:30            setTimeout(() => display_loaded(error), 100);
03:25:30          }
03:25:30        }
03:25:30      
03:25:30        function run_callbacks() {
03:25:30          try {
03:25:30            root._bokeh_onload_callbacks.forEach(function(callback) {
03:25:30              if (callback != null)
03:25:30                callback();
03:25:30            });
03:25:30          } finally {
03:25:30            delete root._bokeh_onload_callbacks
03:25:30          }
03:25:30          console.debug("Bokeh: all callbacks have finished");
03:25:30        }
03:25:30      
03:25:30        function load_libs(css_urls, js_urls, callback) {
03:25:30          if (css_urls == null) css_urls = [];
03:25:30          if (js_urls == null) js_urls = [];
03:25:30      
03:25:30          root._bokeh_onload_callbacks.push(callback);
03:25:30          if (root._bokeh_is_loading > 0) {
03:25:30            console.debug("Bokeh: BokehJS is being loaded, scheduling callback at", now());
03:25:30            return null;
03:25:30          }
03:25:30          if (js_urls == null || js_urls.length === 0) {
03:25:30            run_callbacks();
03:25:30            return null;
03:25:30          }
03:25:30          console.debug("Bokeh: BokehJS not loaded, scheduling load and callback at", now());
03:25:30          root._bokeh_is_loading = css_urls.length + js_urls.length;
03:25:30      
03:25:30          function on_load() {
03:25:30            root._bokeh_is_loading--;
03:25:30            if (root._bokeh_is_loading === 0) {
03:25:30              console.debug("Bokeh: all BokehJS libraries/stylesheets loaded");
03:25:30              run_callbacks()
03:25:30            }
03:25:30          }
03:25:30      
03:25:30          function on_error(url) {
03:25:30            console.error("failed to load " + url);
03:25:30          }
03:25:30      
03:25:30          for (let i = 0; i < css_urls.length; i++) {
03:25:30            const url = css_urls[i];
03:25:30            const element = document.createElement("link");
03:25:30            element.onload = on_load;
03:25:30            element.onerror = on_error.bind(null, url);
03:25:30            element.rel = "stylesheet";
03:25:30            element.type = "text/css";
03:25:30            element.href = url;
03:25:30            console.debug("Bokeh: injecting link tag for BokehJS stylesheet: ", url);
03:25:30            document.body.appendChild(element);
03:25:30          }
03:25:30      
03:25:30          for (let i = 0; i < js_urls.length; i++) {
03:25:30            const url = js_urls[i];
03:25:30            const element = document.createElement('script');
03:25:30            element.onload = on_load;
03:25:30            element.onerror = on_error.bind(null, url);
03:25:30            element.async = false;
03:25:30            element.src = url;
03:25:30            console.debug("Bokeh: injecting script tag for BokehJS library: ", url);
03:25:30            document.head.appendChild(element);
03:25:30          }
03:25:30        };
03:25:30      
03:25:30        function inject_raw_css(css) {
03:25:30          const element = document.createElement("style");
03:25:30          element.appendChild(document.createTextNode(css));
03:25:30          document.body.appendChild(element);
03:25:30        }
03:25:30      
03:25:30        const js_urls = ["https://cdn.bokeh.org/bokeh/release/bokeh-3.4.1.min.js", "https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.4.1.min.js", "https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.4.1.min.js", "https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.4.1.min.js", "https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-3.4.1.min.js", "https://unpkg.com/@holoviz/panel@1.4.2/dist/panel.min.js"];
03:25:30        const css_urls = [];
03:25:30      
03:25:30        const inline_js = [    function(Bokeh) {
03:25:30            Bokeh.set_log_level("info");
03:25:30          },
03:25:30      function(Bokeh) {
03:25:30          }
03:25:30        ];
03:25:30      
03:25:30        function run_inline_js() {
03:25:30          if (root.Bokeh !== undefined || force === true) {
03:25:30            try {
03:25:30                  for (let i = 0; i < inline_js.length; i++) {
03:25:30            inline_js[i].call(root, root.Bokeh);
03:25:30          }
03:25:30      
03:25:30            } catch (error) {display_loaded(error);throw error;
03:25:30            }if (force === true) {
03:25:30              display_loaded();
03:25:30            }} else if (Date.now() < root._bokeh_timeout) {
03:25:30            setTimeout(run_inline_js, 100);
03:25:30          } else if (!root._bokeh_failed_load) {
03:25:30            console.log("Bokeh: BokehJS failed to load within specified timeout.");
03:25:30            root._bokeh_failed_load = true;
03:25:30          } else if (force !== true) {
03:25:30    -       const cell = $(document.getElementById("cbef2947-b8dc-4f3e-9d19-02d8f11ea9e4")).paren
03:25:30    +       const cell = $(document.getElementById("a267c85f-8295-4657-a1f1-6e42ef791601")).paren
03:25:30  
03:25:30