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

Add dataset HTML repr #183

Merged
merged 3 commits into from
Sep 11, 2022
Merged

Add dataset HTML repr #183

merged 3 commits into from
Sep 11, 2022

Conversation

andersy005
Copy link
Member

@andersy005 andersy005 commented Sep 9, 2022

This PR adds an HTML repr to the dataset section. My approach here consists of an external, lightweight FastAPI application that returns the raw xarray's HTML repr.

http -v 'https://html-reprs.fly.dev/xarray/?url=https://ncsa.osn.xsede.org/Pangeo/pangeo-forge/gpcp-feedstock/gpcp.zarr' 
GET /xarray/?url=https://ncsa.osn.xsede.org/Pangeo/pangeo-forge/gpcp-feedstock/gpcp.zarr HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: html-reprs.fly.dev
User-Agent: HTTPie/3.2.1



HTTP/1.1 200 OK
content-encoding: gzip
content-type: application/json
date: Fri, 09 Sep 2022 05:49:21 GMT
fly-request-id: 01GCGCQBBTN8MHZ9593W2E0HF5-dfw
server: Fly/45b85f07 (2022-09-06)
transfer-encoding: chunked
via: 1.1 fly.io

{
    "dataset": "https://ncsa.osn.xsede.org/Pangeo/pangeo-forge/gpcp-feedstock/gpcp.zarr",
    "html": "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n<defs>\n<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n</symbol>\n<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n</symbol>\n</defs>\n</svg>\n<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n *\n */\n\n:root {\n  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n  --xr-background-color: var(--jp-layout-color0, white);\n  --xr-background-color-row-even: var(--jp-layout-color1, white);\n  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n}\n\nhtml[theme=dark],\nbody[data-theme=dark],\nbody.vscode-dark {\n  --xr-font-color0: rgba(255, 255, 255, 1);\n  --xr-font-color2: rgba(255, 255, 255, 0.54);\n  --xr-font-color3: rgba(255, 255, 255, 0.38);\n  --xr-border-color: #1F1F1F;\n  --xr-disabled-color: #515151;\n  --xr-background-color: #111111;\n  --xr-background-color-row-even: #111111;\n  --xr-background-color-row-odd: #313131;\n}\n\n.xr-wrap {\n  display: block !important;\n  min-width: 300px;\n  max-width: 700px;\n}\n\n.xr-text-repr-fallback {\n  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n  display: none;\n}\n\n.xr-header {\n  padding-top: 6px;\n  padding-bottom: 6px;\n  margin-bottom: 4px;\n  border-bottom: solid 1px var(--xr-border-color);\n}\n\n.xr-header > div,\n.xr-header > ul {\n  display: inline;\n  margin-top: 0;\n  margin-bottom: 0;\n}\n\n.xr-obj-type,\n.xr-array-name {\n  margin-left: 2px;\n  margin-right: 10px;\n}\n\n.xr-obj-type {\n  color: var(--xr-font-color2);\n}\n\n.xr-sections {\n  padding-left: 0 !important;\n  display: grid;\n  grid-template-columns: 150px auto auto 1fr 20px 20px;\n}\n\n.xr-section-item {\n  display: contents;\n}\n\n.xr-section-item input {\n  display: none;\n}\n\n.xr-section-item input + label {\n  color: var(--xr-disabled-color);\n}\n\n.xr-section-item input:enabled + label {\n  cursor: pointer;\n  color: var(--xr-font-color2);\n}\n\n.xr-section-item input:enabled + label:hover {\n  color: var(--xr-font-color0);\n}\n\n.xr-section-summary {\n  grid-column: 1;\n  color: var(--xr-font-color2);\n  font-weight: 500;\n}\n\n.xr-section-summary > span {\n  display: inline-block;\n  padding-left: 0.5em;\n}\n\n.xr-section-summary-in:disabled + label {\n  color: var(--xr-font-color2);\n}\n\n.xr-section-summary-in + label:before {\n  display: inline-block;\n  content: '►';\n  font-size: 11px;\n  width: 15px;\n  text-align: center;\n}\n\n.xr-section-summary-in:disabled + label:before {\n  color: var(--xr-disabled-color);\n}\n\n.xr-section-summary-in:checked + label:before {\n  content: '▼';\n}\n\n.xr-section-summary-in:checked + label > span {\n  display: none;\n}\n\n.xr-section-summary,\n.xr-section-inline-details {\n  padding-top: 4px;\n  padding-bottom: 4px;\n}\n\n.xr-section-inline-details {\n  grid-column: 2 / -1;\n}\n\n.xr-section-details {\n  display: none;\n  grid-column: 1 / -1;\n  margin-bottom: 5px;\n}\n\n.xr-section-summary-in:checked ~ .xr-section-details {\n  display: contents;\n}\n\n.xr-array-wrap {\n  grid-column: 1 / -1;\n  display: grid;\n  grid-template-columns: 20px auto;\n}\n\n.xr-array-wrap > label {\n  grid-column: 1;\n  vertical-align: top;\n}\n\n.xr-preview {\n  color: var(--xr-font-color3);\n}\n\n.xr-array-preview,\n.xr-array-data {\n  padding: 0 5px !important;\n  grid-column: 2;\n}\n\n.xr-array-data,\n.xr-array-in:checked ~ .xr-array-preview {\n  display: none;\n}\n\n.xr-array-in:checked ~ .xr-array-data,\n.xr-array-preview {\n  display: inline-block;\n}\n\n.xr-dim-list {\n  display: inline-block !important;\n  list-style: none;\n  padding: 0 !important;\n  margin: 0;\n}\n\n.xr-dim-list li {\n  display: inline-block;\n  padding: 0;\n  margin: 0;\n}\n\n.xr-dim-list:before {\n  content: '(';\n}\n\n.xr-dim-list:after {\n  content: ')';\n}\n\n.xr-dim-list li:not(:last-child):after {\n  content: ',';\n  padding-right: 5px;\n}\n\n.xr-has-index {\n  font-weight: bold;\n}\n\n.xr-var-list,\n.xr-var-item {\n  display: contents;\n}\n\n.xr-var-item > div,\n.xr-var-item label,\n.xr-var-item > .xr-var-name span {\n  background-color: var(--xr-background-color-row-even);\n  margin-bottom: 0;\n}\n\n.xr-var-item > .xr-var-name:hover span {\n  padding-right: 5px;\n}\n\n.xr-var-list > li:nth-child(odd) > div,\n.xr-var-list > li:nth-child(odd) > label,\n.xr-var-list > li:nth-child(odd) > .xr-var-name span {\n  background-color: var(--xr-background-color-row-odd);\n}\n\n.xr-var-name {\n  grid-column: 1;\n}\n\n.xr-var-dims {\n  grid-column: 2;\n}\n\n.xr-var-dtype {\n  grid-column: 3;\n  text-align: right;\n  color: var(--xr-font-color2);\n}\n\n.xr-var-preview {\n  grid-column: 4;\n}\n\n.xr-var-name,\n.xr-var-dims,\n.xr-var-dtype,\n.xr-preview,\n.xr-attrs dt {\n  white-space: nowrap;\n  overflow: hidden;\n  text-overflow: ellipsis;\n  padding-right: 10px;\n}\n\n.xr-var-name:hover,\n.xr-var-dims:hover,\n.xr-var-dtype:hover,\n.xr-attrs dt:hover {\n  overflow: visible;\n  width: auto;\n  z-index: 1;\n}\n\n.xr-var-attrs,\n.xr-var-data {\n  display: none;\n  background-color: var(--xr-background-color) !important;\n  padding-bottom: 5px !important;\n}\n\n.xr-var-attrs-in:checked ~ .xr-var-attrs,\n.xr-var-data-in:checked ~ .xr-var-data {\n  display: block;\n}\n\n.xr-var-data > table {\n  float: right;\n}\n\n.xr-var-name span,\n.xr-var-data,\n.xr-attrs {\n  padding-left: 25px !important;\n}\n\n.xr-attrs,\n.xr-var-attrs,\n.xr-var-data {\n  grid-column: 1 / -1;\n}\n\ndl.xr-attrs {\n  padding: 0;\n  margin: 0;\n  display: grid;\n  grid-template-columns: 125px auto;\n}\n\n.xr-attrs dt,\n.xr-attrs dd {\n  padding: 0;\n  margin: 0;\n  float: left;\n  padding-right: 10px;\n  width: auto;\n}\n\n.xr-attrs dt {\n  font-weight: normal;\n  grid-column: 1;\n}\n\n.xr-attrs dt:hover span {\n  display: inline-block;\n  background: var(--xr-background-color);\n  padding-right: 10px;\n}\n\n.xr-attrs dd {\n  grid-column: 2;\n  white-space: pre-wrap;\n  word-break: break-all;\n}\n\n.xr-icon-database,\n.xr-icon-file-text2 {\n  display: inline-block;\n  vertical-align: middle;\n  width: 1em;\n  height: 1.5em !important;\n  stroke-width: 0;\n  stroke: currentColor;\n  fill: currentColor;\n}\n</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\nDimensions:      (latitude: 180, nv: 2, longitude: 360, time: 9226)\nCoordinates:\n    lat_bounds   (latitude, nv) float32 dask.array&lt;chunksize=(180, 2), meta=np.ndarray&gt;\n  * latitude     (latitude) float32 -90.0 -89.0 -88.0 -87.0 ... 87.0 88.0 89.0\n    lon_bounds   (longitude, nv) float32 dask.array&lt;chunksize=(360, 2), meta=np.ndarray&gt;\n  * longitude    (longitude) float32 0.0 1.0 2.0 3.0 ... 356.0 357.0 358.0 359.0\n  * time         (time) datetime64[ns] 1996-10-01 1996-10-02 ... 2021-12-31\n    time_bounds  (time, nv) datetime64[ns] dask.array&lt;chunksize=(200, 2), meta=np.ndarray&gt;\nDimensions without coordinates: nv\nData variables:\n    precip       (time, latitude, longitude) float32 dask.array&lt;chunksize=(200, 180, 360), meta=np.ndarray&gt;\nAttributes: (12/45)\n    Conventions:                CF-1.6, ACDD 1.3\n    Metadata_Conventions:       CF-1.6, Unidata Dataset Discovery v1.0, NOAA ...\n    acknowledgment:             This project was supported in part by a grant...\n    cdm_data_type:              Grid\n    cdr_program:                NOAA Climate Data Record Program for satellit...\n    cdr_variable:               precipitation\n    ...                         ...\n    standard_name_vocabulary:   CF Standard Name Table (v41, 22 February 2017)\n    summary:                    Global Precipitation Climatology Project (GPC...\n    time_coverage_duration:     P1D\n    time_coverage_end:          1996-10-01T23:59:59Z\n    time_coverage_start:        1996-10-01T00:00:00Z\n    title:                      Global Precipitation Climatatology Project (G...</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-e0633303-36b7-4516-87d8-85dd2de357f6' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-e0633303-36b7-4516-87d8-85dd2de357f6' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>latitude</span>: 180</li><li><span>nv</span>: 2</li><li><span class='xr-has-index'>longitude</span>: 360</li><li><span class='xr-has-index'>time</span>: 9226</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-71dff152-7de5-40c1-9afb-773c44db2456' class='xr-section-summary-in' type='checkbox'  checked><label for='section-71dff152-7de5-40c1-9afb-773c44db2456' class='xr-section-summary' >Coordinates: <span>(6)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>lat_bounds</span></div><div class='xr-var-dims'>(latitude, nv)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>dask.array&lt;chunksize=(180, 2), meta=np.ndarray&gt;</div><input id='attrs-5a645ca1-0e82-42a6-84a2-db964e11494f' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-5a645ca1-0e82-42a6-84a2-db964e11494f' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-8470fa6f-2849-4748-9526-86a8326889ae' class='xr-var-data-in' type='checkbox'><label for='data-8470fa6f-2849-4748-9526-86a8326889ae' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>comment :</span></dt><dd>latitude values at the north and south bounds of each pixel.</dd></dl></div><div class='xr-var-data'><table>\n    <tr>\n        <td>\n            <table>\n                <thead>\n                    <tr>\n                        <td> </td>\n                        <th> Array </th>\n                        <th> Chunk </th>\n                    </tr>\n                </thead>\n                <tbody>\n                    \n                    <tr>\n                        <th> Bytes </th>\n                        <td> 1.41 kiB </td>\n                        <td> 1.41 kiB </td>\n                    </tr>\n                    \n                    <tr>\n                        <th> Shape </th>\n                        <td> (180, 2) </td>\n                        <td> (180, 2) </td>\n                    </tr>\n                    <tr>\n                        <th> Count </th>\n                        <td> 2 Graph Layers </td>\n                        <td> 1 Chunks </td>\n                    </tr>\n                    <tr>\n                    <th> Type </th>\n                    <td> float32 </td>\n                    <td> numpy.ndarray </td>\n                    </tr>\n                </tbody>\n            </table>\n        </td>\n        <td>\n        <svg width=\"75\" height=\"170\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n\n  <!-- Horizontal lines -->\n  <line x1=\"0\" y1=\"0\" x2=\"25\" y2=\"0\" style=\"stroke-width:2\" />\n  <line x1=\"0\" y1=\"120\" x2=\"25\" y2=\"120\" style=\"stroke-width:2\" />\n\n  <!-- Vertical lines -->\n  <line x1=\"0\" y1=\"0\" x2=\"0\" y2=\"120\" style=\"stroke-width:2\" />\n  <line x1=\"25\" y1=\"0\" x2=\"25\" y2=\"120\" style=\"stroke-width:2\" />\n\n  <!-- Colored Rectangle -->\n  <polygon points=\"0.0,0.0 25.924160051965714,0.0 25.924160051965714,120.0 0.0,120.0\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n\n  <!-- Text -->\n  <text x=\"12.962080\" y=\"140.000000\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >2</text>\n  <text x=\"45.924160\" y=\"60.000000\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(-90,45.924160,60.000000)\">180</text>\n</svg>\n        </td>\n    </tr>\n</table></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>latitude</span></div><div class='xr-var-dims'>(latitude)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>-90.0 -89.0 -88.0 ... 88.0 89.0</div><input id='attrs-871d4dc5-574c-4226-83ad-934e5ca89ae4' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-871d4dc5-574c-4226-83ad-934e5ca89ae4' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-6b66fa83-1326-4fca-a1ce-80992996a179' class='xr-var-data-in' type='checkbox'><label for='data-6b66fa83-1326-4fca-a1ce-80992996a179' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>axis :</span></dt><dd>Y</dd><dt><span>long_name :</span></dt><dd>Latitude</dd><dt><span>standard_name :</span></dt><dd>latitude</dd><dt><span>units :</span></dt><dd>degrees_north</dd><dt><span>valid_range :</span></dt><dd>[-90.0, 90.0]</dd></dl></div><div class='xr-var-data'><pre>array([-90., -89., -88., -87., -86., -85., -84., -83., -82., -81., -80., -79.,\n       -78., -77., -76., -75., -74., -73., -72., -71., -70., -69., -68., -67.,\n       -66., -65., -64., -63., -62., -61., -60., -59., -58., -57., -56., -55.,\n       -54., -53., -52., -51., -50., -49., -48., -47., -46., -45., -44., -43.,\n       -42., -41., -40., -39., -38., -37., -36., -35., -34., -33., -32., -31.,\n       -30., -29., -28., -27., -26., -25., -24., -23., -22., -21., -20., -19.,\n       -18., -17., -16., -15., -14., -13., -12., -11., -10.,  -9.,  -8.,  -7.,\n        -6.,  -5.,  -4.,  -3.,  -2.,  -1.,   0.,   1.,   2.,   3.,   4.,   5.,\n         6.,   7.,   8.,   9.,  10.,  11.,  12.,  13.,  14.,  15.,  16.,  17.,\n        18.,  19.,  20.,  21.,  22.,  23.,  24.,  25.,  26.,  27.,  28.,  29.,\n        30.,  31.,  32.,  33.,  34.,  35.,  36.,  37.,  38.,  39.,  40.,  41.,\n        42.,  43.,  44.,  45.,  46.,  47.,  48.,  49.,  50.,  51.,  52.,  53.,\n        54.,  55.,  56.,  57.,  58.,  59.,  60.,  61.,  62.,  63.,  64.,  65.,\n        66.,  67.,  68.,  69.,  70.,  71.,  72.,  73.,  74.,  75.,  76.,  77.,\n        78.,  79.,  80.,  81.,  82.,  83.,  84.,  85.,  86.,  87.,  88.,  89.],\n      dtype=float32)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lon_bounds</span></div><div class='xr-var-dims'>(longitude, nv)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>dask.array&lt;chunksize=(360, 2), meta=np.ndarray&gt;</div><input id='attrs-5534dfda-5ae6-4910-a73a-d5ffa249e11a' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-5534dfda-5ae6-4910-a73a-d5ffa249e11a' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-5c512a6d-f4a7-4e86-9ae6-0372ac809d2c' class='xr-var-data-in' type='checkbox'><label for='data-5c512a6d-f4a7-4e86-9ae6-0372ac809d2c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>comment :</span></dt><dd>longitude values at the west and east bounds of each pixel.</dd></dl></div><div class='xr-var-data'><table>\n    <tr>\n        <td>\n            <table>\n                <thead>\n                    <tr>\n                        <td> </td>\n                        <th> Array </th>\n                        <th> Chunk </th>\n                    </tr>\n                </thead>\n                <tbody>\n                    \n                    <tr>\n                        <th> Bytes </th>\n                        <td> 2.81 kiB </td>\n                        <td> 2.81 kiB </td>\n                    </tr>\n                    \n                    <tr>\n                        <th> Shape </th>\n                        <td> (360, 2) </td>\n                        <td> (360, 2) </td>\n                    </tr>\n                    <tr>\n                        <th> Count </th>\n                        <td> 2 Graph Layers </td>\n                        <td> 1 Chunks </td>\n                    </tr>\n                    <tr>\n                    <th> Type </th>\n                    <td> float32 </td>\n                    <td> numpy.ndarray </td>\n                    </tr>\n                </tbody>\n            </table>\n        </td>\n        <td>\n        <svg width=\"75\" height=\"170\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n\n  <!-- Horizontal lines -->\n  <line x1=\"0\" y1=\"0\" x2=\"25\" y2=\"0\" style=\"stroke-width:2\" />\n  <line x1=\"0\" y1=\"120\" x2=\"25\" y2=\"120\" style=\"stroke-width:2\" />\n\n  <!-- Vertical lines -->\n  <line x1=\"0\" y1=\"0\" x2=\"0\" y2=\"120\" style=\"stroke-width:2\" />\n  <line x1=\"25\" y1=\"0\" x2=\"25\" y2=\"120\" style=\"stroke-width:2\" />\n\n  <!-- Colored Rectangle -->\n  <polygon points=\"0.0,0.0 25.412616514582485,0.0 25.412616514582485,120.0 0.0,120.0\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n\n  <!-- Text -->\n  <text x=\"12.706308\" y=\"140.000000\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >2</text>\n  <text x=\"45.412617\" y=\"60.000000\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(-90,45.412617,60.000000)\">360</text>\n</svg>\n        </td>\n    </tr>\n</table></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>longitude</span></div><div class='xr-var-dims'>(longitude)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>0.0 1.0 2.0 ... 357.0 358.0 359.0</div><input id='attrs-dfb5b69c-ed2f-4656-8fde-21e3591b6f8a' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-dfb5b69c-ed2f-4656-8fde-21e3591b6f8a' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b80d2338-dd1c-419d-80dd-e2187a2df05e' class='xr-var-data-in' type='checkbox'><label for='data-b80d2338-dd1c-419d-80dd-e2187a2df05e' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>axis :</span></dt><dd>X</dd><dt><span>long_name :</span></dt><dd>Longitude</dd><dt><span>standard_name :</span></dt><dd>longitude</dd><dt><span>units :</span></dt><dd>degrees_east</dd><dt><span>valid_range :</span></dt><dd>[0.0, 360.0]</dd></dl></div><div class='xr-var-data'><pre>array([  0.,   1.,   2., ..., 357., 358., 359.], dtype=float32)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>time</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>1996-10-01 ... 2021-12-31</div><input id='attrs-8613f47f-998f-4a34-9b9f-bbc7627765de' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-8613f47f-998f-4a34-9b9f-bbc7627765de' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-6d10a528-5642-42ce-8a3d-2b7e3c382c0f' class='xr-var-data-in' type='checkbox'><label for='data-6d10a528-5642-42ce-8a3d-2b7e3c382c0f' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>axis :</span></dt><dd>T</dd><dt><span>long_name :</span></dt><dd>time</dd><dt><span>standard_name :</span></dt><dd>time</dd></dl></div><div class='xr-var-data'><pre>array([&#x27;1996-10-01T00:00:00.000000000&#x27;, &#x27;1996-10-02T00:00:00.000000000&#x27;,\n       &#x27;1996-10-03T00:00:00.000000000&#x27;, ..., &#x27;2021-12-29T00:00:00.000000000&#x27;,\n       &#x27;2021-12-30T00:00:00.000000000&#x27;, &#x27;2021-12-31T00:00:00.000000000&#x27;],\n      dtype=&#x27;datetime64[ns]&#x27;)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>time_bounds</span></div><div class='xr-var-dims'>(time, nv)</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>dask.array&lt;chunksize=(200, 2), meta=np.ndarray&gt;</div><input id='attrs-e72487e7-e9e9-4c69-a90f-9576c37c28df' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-e72487e7-e9e9-4c69-a90f-9576c37c28df' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-ec5e73e0-026e-4c0d-ac02-8a4260599b00' class='xr-var-data-in' type='checkbox'><label for='data-ec5e73e0-026e-4c0d-ac02-8a4260599b00' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>comment :</span></dt><dd>time bounds for each time value</dd></dl></div><div class='xr-var-data'><table>\n    <tr>\n        <td>\n            <table>\n                <thead>\n                    <tr>\n                        <td> </td>\n                        <th> Array </th>\n                        <th> Chunk </th>\n                    </tr>\n                </thead>\n                <tbody>\n                    \n                    <tr>\n                        <th> Bytes </th>\n                        <td> 144.16 kiB </td>\n                        <td> 3.12 kiB </td>\n                    </tr>\n                    \n                    <tr>\n                        <th> Shape </th>\n                        <td> (9226, 2) </td>\n                        <td> (200, 2) </td>\n                    </tr>\n                    <tr>\n                        <th> Count </th>\n                        <td> 2 Graph Layers </td>\n                        <td> 47 Chunks </td>\n                    </tr>\n                    <tr>\n                    <th> Type </th>\n                    <td> datetime64[ns] </td>\n                    <td> numpy.ndarray </td>\n                    </tr>\n                </tbody>\n            </table>\n        </td>\n        <td>\n        <svg width=\"75\" height=\"170\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n\n  <!-- Horizontal lines -->\n  <line x1=\"0\" y1=\"0\" x2=\"25\" y2=\"0\" style=\"stroke-width:2\" />\n  <line x1=\"0\" y1=\"5\" x2=\"25\" y2=\"5\" />\n  <line x1=\"0\" y1=\"10\" x2=\"25\" y2=\"10\" />\n  <line x1=\"0\" y1=\"18\" x2=\"25\" y2=\"18\" />\n  <line x1=\"0\" y1=\"23\" x2=\"25\" y2=\"23\" />\n  <line x1=\"0\" y1=\"31\" x2=\"25\" y2=\"31\" />\n  <line x1=\"0\" y1=\"36\" x2=\"25\" y2=\"36\" />\n  <line x1=\"0\" y1=\"44\" x2=\"25\" y2=\"44\" />\n  <line x1=\"0\" y1=\"49\" x2=\"25\" y2=\"49\" />\n  <line x1=\"0\" y1=\"57\" x2=\"25\" y2=\"57\" />\n  <line x1=\"0\" y1=\"62\" x2=\"25\" y2=\"62\" />\n  <line x1=\"0\" y1=\"70\" x2=\"25\" y2=\"70\" />\n  <line x1=\"0\" y1=\"75\" x2=\"25\" y2=\"75\" />\n  <line x1=\"0\" y1=\"83\" x2=\"25\" y2=\"83\" />\n  <line x1=\"0\" y1=\"88\" x2=\"25\" y2=\"88\" />\n  <line x1=\"0\" y1=\"96\" x2=\"25\" y2=\"96\" />\n  <line x1=\"0\" y1=\"101\" x2=\"25\" y2=\"101\" />\n  <line x1=\"0\" y1=\"109\" x2=\"25\" y2=\"109\" />\n  <line x1=\"0\" y1=\"114\" x2=\"25\" y2=\"114\" />\n  <line x1=\"0\" y1=\"120\" x2=\"25\" y2=\"120\" style=\"stroke-width:2\" />\n\n  <!-- Vertical lines -->\n  <line x1=\"0\" y1=\"0\" x2=\"0\" y2=\"120\" style=\"stroke-width:2\" />\n  <line x1=\"25\" y1=\"0\" x2=\"25\" y2=\"120\" style=\"stroke-width:2\" />\n\n  <!-- Colored Rectangle -->\n  <polygon points=\"0.0,0.0 25.412616514582485,0.0 25.412616514582485,120.0 0.0,120.0\" style=\"fill:#8B4903A0;stroke-width:0\"/>\n\n  <!-- Text -->\n  <text x=\"12.706308\" y=\"140.000000\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >2</text>\n  <text x=\"45.412617\" y=\"60.000000\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(-90,45.412617,60.000000)\">9226</text>\n</svg>\n        </td>\n    </tr>\n</table></div></li></ul></div></li><li class='xr-section-item'><input id='section-4ef8b17f-3798-49f5-a0a1-18ac663d9106' class='xr-section-summary-in' type='checkbox'  checked><label for='section-4ef8b17f-3798-49f5-a0a1-18ac663d9106' class='xr-section-summary' >Data variables: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>precip</span></div><div class='xr-var-dims'>(time, latitude, longitude)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>dask.array&lt;chunksize=(200, 180, 360), meta=np.ndarray&gt;</div><input id='attrs-b1b0c011-6b87-4721-b8ad-ccda98b3c018' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-b1b0c011-6b87-4721-b8ad-ccda98b3c018' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a8f658c7-7cfc-46bb-895d-a2df3c27d172' class='xr-var-data-in' type='checkbox'><label for='data-a8f658c7-7cfc-46bb-895d-a2df3c27d172' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>cell_methods :</span></dt><dd>area: mean time: mean</dd><dt><span>long_name :</span></dt><dd>NOAA Climate Data Record (CDR) of Daily GPCP Satellite-Gauge Combined Precipitation</dd><dt><span>standard_name :</span></dt><dd>lwe_precipitation_rate</dd><dt><span>units :</span></dt><dd>mm/day</dd><dt><span>valid_range :</span></dt><dd>[0.0, 100.0]</dd></dl></div><div class='xr-var-data'><table>\n    <tr>\n        <td>\n            <table>\n                <thead>\n                    <tr>\n                        <td> </td>\n                        <th> Array </th>\n                        <th> Chunk </th>\n                    </tr>\n                </thead>\n                <tbody>\n                    \n                    <tr>\n                        <th> Bytes </th>\n                        <td> 2.23 GiB </td>\n                        <td> 49.44 MiB </td>\n                    </tr>\n                    \n                    <tr>\n                        <th> Shape </th>\n                        <td> (9226, 180, 360) </td>\n                        <td> (200, 180, 360) </td>\n                    </tr>\n                    <tr>\n                        <th> Count </th>\n                        <td> 2 Graph Layers </td>\n                        <td> 47 Chunks </td>\n                    </tr>\n                    <tr>\n                    <th> Type </th>\n                    <td> float32 </td>\n                    <td> numpy.ndarray </td>\n                    </tr>\n                </tbody>\n            </table>\n        </td>\n        <td>\n        <svg width=\"163\" height=\"149\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n\n  <!-- Horizontal lines -->\n  <line x1=\"10\" y1=\"0\" x2=\"80\" y2=\"70\" style=\"stroke-width:2\" />\n  <line x1=\"10\" y1=\"28\" x2=\"80\" y2=\"99\" style=\"stroke-width:2\" />\n\n  <!-- Vertical lines -->\n  <line x1=\"10\" y1=\"0\" x2=\"10\" y2=\"28\" style=\"stroke-width:2\" />\n  <line x1=\"13\" y1=\"3\" x2=\"13\" y2=\"31\" />\n  <line x1=\"16\" y1=\"6\" x2=\"16\" y2=\"35\" />\n  <line x1=\"20\" y1=\"10\" x2=\"20\" y2=\"39\" />\n  <line x1=\"23\" y1=\"13\" x2=\"23\" y2=\"42\" />\n  <line x1=\"28\" y1=\"18\" x2=\"28\" y2=\"47\" />\n  <line x1=\"31\" y1=\"21\" x2=\"31\" y2=\"50\" />\n  <line x1=\"36\" y1=\"26\" x2=\"36\" y2=\"54\" />\n  <line x1=\"39\" y1=\"29\" x2=\"39\" y2=\"57\" />\n  <line x1=\"43\" y1=\"33\" x2=\"43\" y2=\"62\" />\n  <line x1=\"46\" y1=\"36\" x2=\"46\" y2=\"65\" />\n  <line x1=\"51\" y1=\"41\" x2=\"51\" y2=\"70\" />\n  <line x1=\"54\" y1=\"44\" x2=\"54\" y2=\"73\" />\n  <line x1=\"58\" y1=\"48\" x2=\"58\" y2=\"77\" />\n  <line x1=\"62\" y1=\"52\" x2=\"62\" y2=\"80\" />\n  <line x1=\"66\" y1=\"56\" x2=\"66\" y2=\"85\" />\n  <line x1=\"69\" y1=\"59\" x2=\"69\" y2=\"88\" />\n  <line x1=\"74\" y1=\"64\" x2=\"74\" y2=\"93\" />\n  <line x1=\"77\" y1=\"67\" x2=\"77\" y2=\"96\" />\n  <line x1=\"80\" y1=\"70\" x2=\"80\" y2=\"99\" style=\"stroke-width:2\" />\n\n  <!-- Colored Rectangle -->\n  <polygon points=\"10.0,0.0 80.58823529411765,70.58823529411765 80.58823529411765,99.47962497193 10.0,28.89138967781234\" style=\"fill:#8B4903A0;stroke-width:0\"/>\n\n  <!-- Horizontal lines -->\n  <line x1=\"10\" y1=\"0\" x2=\"42\" y2=\"0\" style=\"stroke-width:2\" />\n  <line x1=\"13\" y1=\"3\" x2=\"46\" y2=\"3\" />\n  <line x1=\"16\" y1=\"6\" x2=\"49\" y2=\"6\" />\n  <line x1=\"20\" y1=\"10\" x2=\"53\" y2=\"10\" />\n  <line x1=\"23\" y1=\"13\" x2=\"56\" y2=\"13\" />\n  <line x1=\"28\" y1=\"18\" x2=\"61\" y2=\"18\" />\n  <line x1=\"31\" y1=\"21\" x2=\"64\" y2=\"21\" />\n  <line x1=\"36\" y1=\"26\" x2=\"68\" y2=\"26\" />\n  <line x1=\"39\" y1=\"29\" x2=\"72\" y2=\"29\" />\n  <line x1=\"43\" y1=\"33\" x2=\"76\" y2=\"33\" />\n  <line x1=\"46\" y1=\"36\" x2=\"79\" y2=\"36\" />\n  <line x1=\"51\" y1=\"41\" x2=\"84\" y2=\"41\" />\n  <line x1=\"54\" y1=\"44\" x2=\"87\" y2=\"44\" />\n  <line x1=\"58\" y1=\"48\" x2=\"91\" y2=\"48\" />\n  <line x1=\"62\" y1=\"52\" x2=\"95\" y2=\"52\" />\n  <line x1=\"66\" y1=\"56\" x2=\"99\" y2=\"56\" />\n  <line x1=\"69\" y1=\"59\" x2=\"102\" y2=\"59\" />\n  <line x1=\"74\" y1=\"64\" x2=\"107\" y2=\"64\" />\n  <line x1=\"77\" y1=\"67\" x2=\"110\" y2=\"67\" />\n  <line x1=\"80\" y1=\"70\" x2=\"113\" y2=\"70\" style=\"stroke-width:2\" />\n\n  <!-- Vertical lines -->\n  <line x1=\"10\" y1=\"0\" x2=\"80\" y2=\"70\" style=\"stroke-width:2\" />\n  <line x1=\"42\" y1=\"0\" x2=\"113\" y2=\"70\" style=\"stroke-width:2\" />\n\n  <!-- Colored Rectangle -->\n  <polygon points=\"10.0,0.0 42.98228376816201,0.0 113.57051906227966,70.58823529411765 80.58823529411765,70.58823529411765\" style=\"fill:#8B4903A0;stroke-width:0\"/>\n\n  <!-- Horizontal lines -->\n  <line x1=\"80\" y1=\"70\" x2=\"113\" y2=\"70\" style=\"stroke-width:2\" />\n  <line x1=\"80\" y1=\"99\" x2=\"113\" y2=\"99\" style=\"stroke-width:2\" />\n\n  <!-- Vertical lines -->\n  <line x1=\"80\" y1=\"70\" x2=\"80\" y2=\"99\" style=\"stroke-width:2\" />\n  <line x1=\"113\" y1=\"70\" x2=\"113\" y2=\"99\" style=\"stroke-width:2\" />\n\n  <!-- Colored Rectangle -->\n  <polygon points=\"80.58823529411765,70.58823529411765 113.57051906227966,70.58823529411765 113.57051906227966,99.47962497193 80.58823529411765,99.47962497193\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n\n  <!-- Text -->\n  <text x=\"97.079377\" y=\"119.479625\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >360</text>\n  <text x=\"133.570519\" y=\"85.033930\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(-90,133.570519,85.033930)\">180</text>\n  <text x=\"35.294118\" y=\"84.185507\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(45,35.294118,84.185507)\">9226</text>\n</svg>\n        </td>\n    </tr>\n</table></div></li></ul></div></li><li class='xr-section-item'><input id='section-e66c867e-9621-49e8-8be6-ef2dca7ccb21' class='xr-section-summary-in' type='checkbox'  ><label for='section-e66c867e-9621-49e8-8be6-ef2dca7ccb21' class='xr-section-summary' >Attributes: <span>(45)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>Conventions :</span></dt><dd>CF-1.6, ACDD 1.3</dd><dt><span>Metadata_Conventions :</span></dt><dd>CF-1.6, Unidata Dataset Discovery v1.0, NOAA CDR v1.0, GDS v2.0</dd><dt><span>acknowledgment :</span></dt><dd>This project was supported in part by a grant from the NOAA Climate Data Record (CDR) Program for satellites.</dd><dt><span>cdm_data_type :</span></dt><dd>Grid</dd><dt><span>cdr_program :</span></dt><dd>NOAA Climate Data Record Program for satellites, FY 2011.</dd><dt><span>cdr_variable :</span></dt><dd>precipitation</dd><dt><span>comment :</span></dt><dd>Processing computer: eagle2.umd.edu</dd><dt><span>contributor_name :</span></dt><dd>Robert Adler, Jian-Jian Wang</dd><dt><span>contributor_role :</span></dt><dd>principalInvestigator, processor and custodian</dd><dt><span>creator_email :</span></dt><dd>[email protected]</dd><dt><span>creator_name :</span></dt><dd>Dr. Jian-Jian Wang</dd><dt><span>date_created :</span></dt><dd>2017-05-30T16:52:42Z</dd><dt><span>geospatial_lat_max :</span></dt><dd>90.0</dd><dt><span>geospatial_lat_min :</span></dt><dd>-90.0</dd><dt><span>geospatial_lat_resolution :</span></dt><dd>1 degree</dd><dt><span>geospatial_lat_units :</span></dt><dd>degrees_north</dd><dt><span>geospatial_lon_max :</span></dt><dd>360.0</dd><dt><span>geospatial_lon_min :</span></dt><dd>0.0</dd><dt><span>geospatial_lon_resolution :</span></dt><dd>1 degree</dd><dt><span>geospatial_lon_units :</span></dt><dd>degrees_east</dd><dt><span>history :</span></dt><dd>1) 2017-05-30T16:52:42Z, Dr. Jian-Jian Wang, U of Maryland, Created beta (B1) file</dd><dt><span>id :</span></dt><dd>199610/gpcp_v01r03_daily_d19961001_c20170530.nc</dd><dt><span>institution :</span></dt><dd>ACADEMIC &gt; UMD/ESSIC &gt; Earth System Science Interdisciplinary Center, University of Maryland</dd><dt><span>keywords :</span></dt><dd>EARTH SCIENCE &gt; ATMOSPHERE &gt; PRECIPITATION &gt; PRECIPITATION AMOUNT</dd><dt><span>keywords_vocabulary :</span></dt><dd>NASA Global Change Master Directory (GCMD) Earth Science Keywords, Version 7.0</dd><dt><span>license :</span></dt><dd>No constraints on data access or use.</dd><dt><span>metadata_link :</span></dt><dd>gov.noaa.ncdc:XXXXX</dd><dt><span>naming_authority :</span></dt><dd>gov.noaa.ncdc</dd><dt><span>platform :</span></dt><dd>GOES (Geostationary Operational Environmental Satellite), GMS (Japan Geostationary Meteorological Satellite), METEOSAT, TIROS &gt; Television Infrared Observation Satellite, DMSP (Defense Meteorological Satellite Program)</dd><dt><span>processing_level :</span></dt><dd>NASA Level 3</dd><dt><span>product_version :</span></dt><dd>v01r03</dd><dt><span>project :</span></dt><dd>GPCP &gt; Global Precipitation Climatology Project</dd><dt><span>publisher_email :</span></dt><dd>[email protected]</dd><dt><span>publisher_name :</span></dt><dd>NOAA National Centers for Environmental Information (NCEI)</dd><dt><span>publisher_url :</span></dt><dd>https://www.ncei.noaa.gov</dd><dt><span>references :</span></dt><dd>Huffman et al. 1997, http://dx.doi.org/10.1175/1520-0477(1997)078&lt;0005:TGPCPG&gt;2.0.CO;2; Adler et al. 2003, http://dx.doi.org/10.1175/1525-7541(2003)004&lt;1147:TVGPCP&gt;2.0.CO;2; Huffman et al. 2009, http://dx.doi.org/10.1029/2009GL040000; Adler et al. 2017, Global Precipitation Climatology Project (GPCP) Daily Analysis: Climate Algorithm Theoretical Basis Document (C-ATBD)</dd><dt><span>sensor :</span></dt><dd>Imager, TOVS &gt; TIROS Operational Vertical Sounder, SSMI &gt; Special Sensor Microwave/Imager</dd><dt><span>source :</span></dt><dd>/data1/GPCP_CDR/GPCP_Output/1DD//bin/199610/stfsg3.19961001.s</dd><dt><span>spatial_resolution :</span></dt><dd>1 degree</dd><dt><span>standard_name_vocabulary :</span></dt><dd>CF Standard Name Table (v41, 22 February 2017)</dd><dt><span>summary :</span></dt><dd>Global Precipitation Climatology Project (GPCP) Daily Version 1.3 gridded, merged satellite/gauge precipitation Climate data Record (CDR) from 1996 to present.</dd><dt><span>time_coverage_duration :</span></dt><dd>P1D</dd><dt><span>time_coverage_end :</span></dt><dd>1996-10-01T23:59:59Z</dd><dt><span>time_coverage_start :</span></dt><dd>1996-10-01T00:00:00Z</dd><dt><span>title :</span></dt><dd>Global Precipitation Climatatology Project (GPCP) Climate Data Record (CDR), Daily V1.3</dd></dl></div></li></ul></div></div>"
}

I then render this raw HTML inside our existing DatasetAccordion component: e.g. https://pangeo-forge-j1838fava-pangeo-forge.vercel.app/dashboard/feedstock/42

Screen Shot 2022-09-08 at 11 43 21 PM

This tiny FastAPI app currently resides here: https://github.com/andersy005/html-reprs. this app can be merged into the pangeo-forge/pangeo-forge-orchestrator. @cisaacstern, do you anticipate any cons with this proposal to move this tiny application into the orchestrator?

Copy link
Member

@cisaacstern cisaacstern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andersy005, this is awesome 🎉

do you anticipate any cons with this proposal to move this tiny application into the orchestrator?

Nope! This will be easy & very welcome. I would propose adding your /xarray/ route as its own router here.

Question: Can the html string returned by this /xarray/ route be embedded in a GitHub comment?

If so, perhaps we'd want to factor the logic that creates this html into a function, so that we can also use it to embed html reprs in the comments provided to users when test runs succeed, e.g. pangeo-forge/staged-recipes#87 (comment).

Copy link

@rabernat rabernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mind blown

I love it so much!

...

I believe this is a good short term solution to ship a much needed feature quickly. This is the same approach used in https://catalog.pangeo.io/.

However, in the long term, I don't think this architecture is optimal for the following reasons:

  • Opening the dataset with python on the backend is expensive and ultimately unnecessary, since the Zarr dataset is well described by a compact json file.
  • Xarray's html repr is unnecessarily large, with lots of inline custom CSS. That will prevent us from customizing the look and feel of the display.

Instead, I think we should aim to develop a native javascript solution to generating the dataset preview. Ideally an npm package providing react components that we can simply drop in instead of the API call. Maybe something like that already exists? Some inspiration for how this would look can be found at https://idr.github.io/ome-ngff-samples/.

If we go with this solution, we should open a placeholder issue to keep track of that for a future refactor.

Copy link
Collaborator

@katamartin katamartin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So cool to see this in place, looks great to me!

src/components/dashboard/datasets-accordion.js Outdated Show resolved Hide resolved
src/pages/api/repr/xarray.js Outdated Show resolved Hide resolved
@andersy005
Copy link
Member Author

I believe this is a good short term solution to ship a much needed feature quickly.

I concur... This seemed to be a quick way to get this working from what I discussed with @freeman-lab and @katamartin. I've started working on some draft mockups for a lightweight/long term REPR that takes advantage of information persisted in the Zarr's consolidated metadata.

If we go with this solution, we should open a placeholder issue to keep track of that for a future refactor.

We could keep track of this in

Comment on lines +22 to +25
<Alert status='error' align='center' justifyContent='center'>
<AlertIcon />
{`Status Code: ${reprError.status}`} - {reprError.info?.detail}
</Alert>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@katamartin, it turns out that our useSWR's JSONFetcher returns an Error object with a bit of useful information

const error = new Error('An error occurred while fetching the data.')
// Attach extra info to the error object.
error.info = await response.json()
error.status = response.status
throw error
}

i ended up taking advantage of this and got rid of the /api/repr/xarray API route. So, this change ensures the errors are properly propagated to the client.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2022-09-10 at 10 14 27 PM

@andersy005
Copy link
Member Author

Question: Can the html string returned by this /xarray/ route be embedded in a GitHub comment?

Unfortunately, the answer is no... From what I understand, GitHub's markdown can only contain certain HTML elements, and most of what's in Xarray's HTML string isn't supported by GitHub

@jhamman
Copy link

jhamman commented Sep 14, 2022

Question: Can the html string returned by this /xarray/ route be embedded in a GitHub comment?

Agree with @andersy005 that we can't render Xarray's html but we could post a PNG or the text output from ds.info()

@rabernat
Copy link

rabernat commented Sep 14, 2022

For GH, let's just stick with the plain-text dataset repr. Perhaps we could check the content-type of the GET request in order to determine the format.

  • text/plain (default) -> the text repr
  • text/html -> the html repr
  • text/json -> the json repr (ds.to_dict(data=False))

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

Successfully merging this pull request may close these issues.

5 participants