Created
February 23, 2021 05:15
-
-
Save fivejjs/52133c79fe06bcaf6fdbbc2666ce8eb3 to your computer and use it in GitHub Desktop.
sample-ipynb
This file contains hidden or 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
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# crop-mask datacube indexing trials\n", | |
"\n", | |
"## pre-requirements\n", | |
"- optional depends on pystac\n", | |
"\n", | |
"## required\n", | |
"- datacube package installed and setup the local db config \".datacube.conf\"\n", | |
"- and postgresql db initialized" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import pystac" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import os" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import json\n", | |
"\n", | |
"with open('crop-mask-json-template-good-looking.json') as fh:\n", | |
" meta_dat = json.load(fh)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"dict_keys(['type', 'stac_version', 'id', 'properties', 'geometry', 'links', 'assets', 'bbox', 'stac_extensions'])" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"meta_dat.keys()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"with open('crop-mask-json-template.json') as fhin:\n", | |
" meta_tmpl = json.load(fhin)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"dict_keys(['type', 'stac_version', 'id', 'properties', 'geometry', 'links', 'assets', 'bbox', 'stac_extensions'])" | |
] | |
}, | |
"execution_count": 9, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"meta_tmpl.keys()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"with open('original_crop_mask_sample.json', 'w') as fhout:\n", | |
" json.dump(meta_tmpl, fhout, indent=2)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from pystac import Catalog" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from odc.index.stac import stac_transform" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import json\n", | |
"\n", | |
"with open('crop-mask-json-template-good-looking.json') as fh:\n", | |
" data = json.load(fh)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"results = stac_transform(data)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"{'$schema': 'https://schemas.opendatacube.org/dataset',\n", | |
" 'crs': 'epsg:6933',\n", | |
" 'geometry': {'coordinates': (((4608000.0, 1056000.0),\n", | |
" (4608000.0, 960000.0),\n", | |
" (4704000.0, 960000.0),\n", | |
" (4704000.0, 1056000.0),\n", | |
" (4608000.0, 1056000.0)),),\n", | |
" 'type': 'Polygon'},\n", | |
" 'grids': {'default': {'shape': [4800, 4800],\n", | |
" 'transform': [20.0,\n", | |
" 0.0,\n", | |
" 4608000.0,\n", | |
" 0.0,\n", | |
" -20.0,\n", | |
" 1056000.0,\n", | |
" 0.0,\n", | |
" 0.0,\n", | |
" 1.0]}},\n", | |
" 'id': 'f8944fb1-826a-5fd0-b1bb-92a3ced000a7',\n", | |
" 'label': 'f8944fb1-826a-5fd0-b1bb-92a3ced000a7',\n", | |
" 'lineage': {'inputs': []},\n", | |
" 'measurements': {'crop_mask': {'path': 'ga_s2_gm_x+048y+010_2019-07--P6M_B02.tif'},\n", | |
" 'crop_prob': {'path': 'ga_s2_gm_x+048y+010_2019-07--P6M_B03.tif'}},\n", | |
" 'product': {'name': 'crop_mask(to validate)'},\n", | |
" 'properties': {'datetime': '2019-07-01T00:00:00Z',\n", | |
" 'dtr:end_datetime': '2019-12-31T23:59:59.999999Z',\n", | |
" 'dtr:start_datetime': '2019-07-01T00:00:00.000000Z',\n", | |
" 'eo:platform': 'sentinel-2',\n", | |
" 'odc:file_format': 'GeoTIFF',\n", | |
" 'odc:processing_datetime': '2021-02-14T07:29:22Z',\n", | |
" 'odc:producer': 'Digital Earth Africa(TBD)',\n", | |
" 'odc:product': 'crop_mask(to validate)',\n", | |
" 'odc:product_family': 'statistics(TBD)',\n", | |
" 'odc:region_code': 'x+048y+010',\n", | |
" 'proj:epsg': 6933}}\n" | |
] | |
} | |
], | |
"source": [ | |
"import pprint\n", | |
"\n", | |
"pprint.pprint(results)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### prepare the db insert hack" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 29, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from datacube import Datacube\n", | |
"\n", | |
"dc = Datacube(app='__name__')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 25, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from datacube.model import DatasetType, MetadataType, Dataset" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 37, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"_EXAMPLE_METADATA_TYPE = MetadataType(\n", | |
" {\n", | |
" 'name': 'eo3',\n", | |
" 'dataset': dict(\n", | |
" id=['id'],\n", | |
" label=['ga_label'],\n", | |
" creation_time=['creation_dt'],\n", | |
" measurements=['image', 'bands'],\n", | |
" sources=['lineage', 'source_datasets']\n", | |
" )\n", | |
" },\n", | |
" dataset_search_fields={},\n", | |
" id_=1 # hacking by reading postgresql db\n", | |
"\n", | |
")\n", | |
"\n", | |
"_EXAMPLE_DATASET_TYPE = DatasetType(\n", | |
" _EXAMPLE_METADATA_TYPE,\n", | |
" {\n", | |
" 'name': 'eo3',\n", | |
" 'description': \"\",\n", | |
" 'metadata_type': 'eo3',\n", | |
" 'metadata': {}\n", | |
" },\n", | |
" id_=2\n", | |
")\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 38, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"dataset = Dataset(_EXAMPLE_DATASET_TYPE, results)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 39, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"(DatasetType(name='eo3', id_=2), MetadataType(name='eo3', id_=1))" | |
] | |
}, | |
"execution_count": 39, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"dataset.type, dataset.metadata_type" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 40, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Dataset <id=f8944fb1-826a-5fd0-b1bb-92a3ced000a7 product=eo3 location=not available>" | |
] | |
}, | |
"execution_count": 40, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"dc.index.datasets.add(dataset)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## pgadmin select to check results\n", | |
"```sql\n", | |
"select * from agdc.dataset \n", | |
"where added >= '2021-01-23'\n", | |
"limit 10;\n", | |
"```" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 41, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"inserted_json = {\n", | |
" \"id\": \"f8944fb1-826a-5fd0-b1bb-92a3ced000a7\",\n", | |
" \"crs\": \"epsg:6933\",\n", | |
" \"grids\": {\n", | |
" \"default\": {\n", | |
" \"shape\": [\n", | |
" 4800,\n", | |
" 4800\n", | |
" ],\n", | |
" \"transform\": [\n", | |
" 20,\n", | |
" 0,\n", | |
" 4608000,\n", | |
" 0,\n", | |
" -20,\n", | |
" 1056000,\n", | |
" 0,\n", | |
" 0,\n", | |
" 1\n", | |
" ]\n", | |
" }\n", | |
" },\n", | |
" \"label\": \"f8944fb1-826a-5fd0-b1bb-92a3ced000a7\",\n", | |
" \"$schema\": \"https://schemas.opendatacube.org/dataset\",\n", | |
" \"lineage\": {\n", | |
" \"inputs\": []\n", | |
" },\n", | |
" \"product\": {\n", | |
" \"name\": \"crop_mask(to validate)\"\n", | |
" },\n", | |
" \"geometry\": {\n", | |
" \"type\": \"Polygon\",\n", | |
" \"coordinates\": [\n", | |
" [\n", | |
" [\n", | |
" 4608000,\n", | |
" 1056000\n", | |
" ],\n", | |
" [\n", | |
" 4608000,\n", | |
" 960000\n", | |
" ],\n", | |
" [\n", | |
" 4704000,\n", | |
" 960000\n", | |
" ],\n", | |
" [\n", | |
" 4704000,\n", | |
" 1056000\n", | |
" ],\n", | |
" [\n", | |
" 4608000,\n", | |
" 1056000\n", | |
" ]\n", | |
" ]\n", | |
" ]\n", | |
" },\n", | |
" \"properties\": {\n", | |
" \"datetime\": \"2019-07-01T00:00:00Z\",\n", | |
" \"proj:epsg\": 6933,\n", | |
" \"eo:platform\": \"sentinel-2\",\n", | |
" \"odc:product\": \"crop_mask(to validate)\",\n", | |
" \"odc:producer\": \"Digital Earth Africa(TBD)\",\n", | |
" \"odc:file_format\": \"GeoTIFF\",\n", | |
" \"odc:region_code\": \"x+048y+010\",\n", | |
" \"dtr:end_datetime\": \"2019-12-31T23:59:59.999999Z\",\n", | |
" \"dtr:start_datetime\": \"2019-07-01T00:00:00.000000Z\",\n", | |
" \"odc:product_family\": \"statistics(TBD)\",\n", | |
" \"odc:processing_datetime\": \"2021-02-14T07:29:22Z\"\n", | |
" },\n", | |
" \"measurements\": {\n", | |
" \"crop_mask\": {\n", | |
" \"path\": \"ga_s2_gm_x+048y+010_2019-07--P6M_B02.tif\"\n", | |
" },\n", | |
" \"crop_prob\": {\n", | |
" \"path\": \"ga_s2_gm_x+048y+010_2019-07--P6M_B03.tif\"\n", | |
" }\n", | |
" }\n", | |
"}" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 43, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'$schema': 'https://schemas.opendatacube.org/dataset',\n", | |
" 'id': 'f8944fb1-826a-5fd0-b1bb-92a3ced000a7',\n", | |
" 'crs': 'epsg:6933',\n", | |
" 'grids': {'default': {'shape': [4800, 4800],\n", | |
" 'transform': [20.0, 0.0, 4608000.0, 0.0, -20.0, 1056000.0, 0.0, 0.0, 1.0]}},\n", | |
" 'product': {'name': 'crop_mask(to validate)'},\n", | |
" 'label': 'f8944fb1-826a-5fd0-b1bb-92a3ced000a7',\n", | |
" 'properties': {'odc:file_format': 'GeoTIFF',\n", | |
" 'odc:producer': 'Digital Earth Africa(TBD)',\n", | |
" 'odc:product_family': 'statistics(TBD)',\n", | |
" 'eo:platform': 'sentinel-2',\n", | |
" 'dtr:start_datetime': '2019-07-01T00:00:00.000000Z',\n", | |
" 'dtr:end_datetime': '2019-12-31T23:59:59.999999Z',\n", | |
" 'odc:processing_datetime': '2021-02-14T07:29:22Z',\n", | |
" 'odc:region_code': 'x+048y+010',\n", | |
" 'odc:product': 'crop_mask(to validate)',\n", | |
" 'proj:epsg': 6933,\n", | |
" 'datetime': '2019-07-01T00:00:00Z'},\n", | |
" 'measurements': {'crop_mask': {'path': 'ga_s2_gm_x+048y+010_2019-07--P6M_B02.tif'},\n", | |
" 'crop_prob': {'path': 'ga_s2_gm_x+048y+010_2019-07--P6M_B03.tif'}},\n", | |
" 'lineage': {'inputs': []},\n", | |
" 'geometry': {'type': 'Polygon',\n", | |
" 'coordinates': (((4608000.0, 1056000.0),\n", | |
" (4608000.0, 960000.0),\n", | |
" (4704000.0, 960000.0),\n", | |
" (4704000.0, 1056000.0),\n", | |
" (4608000.0, 1056000.0)),)}}" | |
] | |
}, | |
"execution_count": 43, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"results" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 44, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>name</th>\n", | |
" <th>description</th>\n", | |
" <th>creation_time</th>\n", | |
" <th>lat</th>\n", | |
" <th>region_code</th>\n", | |
" <th>label</th>\n", | |
" <th>time</th>\n", | |
" <th>instrument</th>\n", | |
" <th>product_family</th>\n", | |
" <th>platform</th>\n", | |
" <th>dataset_maturity</th>\n", | |
" <th>lon</th>\n", | |
" <th>format</th>\n", | |
" <th>crs</th>\n", | |
" <th>resolution</th>\n", | |
" <th>tile_size</th>\n", | |
" <th>spatial_dimensions</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>id</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>crop_mask</td>\n", | |
" <td>prediction based s2 l2a gm_tmad, NDVI, LAI, MN...</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>s2_l2a</td>\n", | |
" <td>Sentinel-2a and Sentinel-2b imagery, processed...</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>None</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" name description \\\n", | |
"id \n", | |
"3 crop_mask prediction based s2 l2a gm_tmad, NDVI, LAI, MN... \n", | |
"2 s2_l2a Sentinel-2a and Sentinel-2b imagery, processed... \n", | |
"\n", | |
" creation_time lat region_code label time instrument product_family \\\n", | |
"id \n", | |
"3 None None None None None None None \n", | |
"2 None None None None None None None \n", | |
"\n", | |
" platform dataset_maturity lon format crs resolution tile_size \\\n", | |
"id \n", | |
"3 None None None None NaN NaN NaN \n", | |
"2 None None None None NaN NaN NaN \n", | |
"\n", | |
" spatial_dimensions \n", | |
"id \n", | |
"3 NaN \n", | |
"2 NaN " | |
] | |
}, | |
"execution_count": 44, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"dc.list_products()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 46, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from datacube.utils.geometry import Geometry" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 48, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"geojson = {\n", | |
" \"type\": \"Polygon\",\n", | |
" \"coordinates\": [\n", | |
" [\n", | |
" [\n", | |
" 4608000,\n", | |
" 1056000\n", | |
" ],\n", | |
" [\n", | |
" 4608000,\n", | |
" 960000\n", | |
" ],\n", | |
" [\n", | |
" 4704000,\n", | |
" 960000\n", | |
" ],\n", | |
" [\n", | |
" 4704000,\n", | |
" 1056000\n", | |
" ],\n", | |
" [\n", | |
" 4608000,\n", | |
" 1056000\n", | |
" ]\n", | |
" ]\n", | |
" ]\n", | |
" }" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 49, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"geom = Geometry(geojson, crs='epsg:6933')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 52, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"new_results = dc.load('crop_mask', \n", | |
" geopolygon=geom, \n", | |
" measurements=['crop_mask', 'crop_prob'])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 53, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/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", | |
"\n", | |
"html[theme=dark],\n", | |
"body.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;\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", | |
"\n", | |
"dl.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'><xarray.Dataset>\n", | |
"Dimensions: ()\n", | |
"Data variables:\n", | |
" *empty*</pre><div class='xr-wrap' hidden><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-fe348dbb-2842-4ac9-b3c0-9c273338fc99' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-fe348dbb-2842-4ac9-b3c0-9c273338fc99' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-a696fd85-712e-4cb7-ade8-e526279e4566' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-a696fd85-712e-4cb7-ade8-e526279e4566' class='xr-section-summary' title='Expand/collapse section'>Coordinates: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'></ul></div></li><li class='xr-section-item'><input id='section-e939872c-16d2-44e5-9d92-f32b6b229f8d' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-e939872c-16d2-44e5-9d92-f32b6b229f8d' class='xr-section-summary' title='Expand/collapse section'>Data variables: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'></ul></div></li><li class='xr-section-item'><input id='section-d591184b-abbc-494f-8313-6f01ce66bfb8' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-d591184b-abbc-494f-8313-6f01ce66bfb8' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>" | |
], | |
"text/plain": [ | |
"<xarray.Dataset>\n", | |
"Dimensions: ()\n", | |
"Data variables:\n", | |
" *empty*" | |
] | |
}, | |
"execution_count": 53, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"new_results" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.12" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment