Skip to content

Commit

Permalink
feat: Distinguish between continuous and discrete data. Refs #16 🎁
Browse files Browse the repository at this point in the history
  • Loading branch information
luukvdmeer committed Sep 22, 2022
1 parent b0cd038 commit 2244625
Show file tree
Hide file tree
Showing 11 changed files with 534 additions and 476 deletions.
12 changes: 6 additions & 6 deletions demo/files/layout.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
]
},
"greenness": {
"type": "numerical",
"type": "continuous",
"description": "Greenness",
"values": {
"min": 0,
Expand All @@ -178,7 +178,7 @@
]
},
"brightness": {
"type": "numerical",
"type": "continuous",
"description": "Overall brightness",
"values": {
"min": 0,
Expand Down Expand Up @@ -239,7 +239,7 @@
"reflectance": {
"s2_band04": {
"description": "Reflectance of Band 4 of Sentinel 2A or Sentinel 2B",
"type": "numerical",
"type": "continuous",
"values": {
"min": 0,
"max": 10000,
Expand All @@ -254,7 +254,7 @@
},
"s2_band03": {
"description": "Reflectance of Band 3 of Sentinel 2A or Sentinel 2B",
"type": "numerical",
"type": "continuous",
"values": {
"min": 0,
"max": 10000,
Expand All @@ -269,7 +269,7 @@
},
"s2_band02": {
"description": "Reflectance of Band 2 of Sentinel 2A or Sentinel 2B",
"type": "numerical",
"type": "continuous",
"values": {
"min": 0,
"max": 10000,
Expand All @@ -284,7 +284,7 @@
},
"s2_band08": {
"description": "Reflectance of Band 8 of Sentinel 2A or Sentinel 2B",
"type": "numerical",
"type": "continuous",
"values": {
"min": 0,
"max": 10000,
Expand Down
24 changes: 12 additions & 12 deletions demo/files/logs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Coordinates:
temporal_ref int64 0
spatial_feats (y, x) float64 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0 1.0
Attributes:
value_type: numerical
value_type: discrete
Finished executing result: 'blue_map'
Started executing result: 'green_map'
Translating concept ['entity', 'vegetation']
Expand Down Expand Up @@ -231,7 +231,7 @@ Coordinates:
temporal_ref int64 0
spatial_feats (y, x) float64 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0 1.0
Attributes:
value_type: numerical
value_type: discrete
Finished executing result: 'green_map'
Started executing result: 'blue_curve'
Translating concept ['entity', 'water']
Expand Down Expand Up @@ -329,7 +329,7 @@ Coordinates:
spatial_ref int64 0
temporal_ref int64 0
Attributes:
value_type: numerical
value_type: discrete
Finished executing result: 'blue_curve'
Started executing result: 'green_curve'
Translating concept ['entity', 'vegetation']
Expand Down Expand Up @@ -427,7 +427,7 @@ Coordinates:
spatial_ref int64 0
temporal_ref int64 0
Attributes:
value_type: numerical
value_type: discrete
Finished executing result: 'green_curve'
Started executing result: 'blue_stat'
Translating concept ['entity', 'water']
Expand Down Expand Up @@ -524,7 +524,7 @@ Coordinates:
spatial_ref int64 0
temporal_ref int64 0
Attributes:
value_type: numerical
value_type: discrete
Finished executing result: 'blue_stat'
Started executing result: 'green_stat'
Translating concept ['entity', 'vegetation']
Expand Down Expand Up @@ -621,7 +621,7 @@ Coordinates:
spatial_ref int64 0
temporal_ref int64 0
Attributes:
value_type: numerical
value_type: discrete
Finished executing result: 'green_stat'
Finished executing the semantic query
Responding:
Expand All @@ -637,7 +637,7 @@ Coordinates:
temporal_ref int64 0
spatial_feats (y, x) float64 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0 1.0
Attributes:
value_type: numerical, 'green_map': <xarray.DataArray 'green_map' (y: 4, x: 4)>
value_type: discrete, 'green_map': <xarray.DataArray 'green_map' (y: 4, x: 4)>
array([[1., 2., 1., 2.],
[2., 2., 0., 1.],
[1., 1., 0., 1.],
Expand All @@ -649,30 +649,30 @@ Coordinates:
temporal_ref int64 0
spatial_feats (y, x) float64 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0 1.0
Attributes:
value_type: numerical, 'blue_curve': <xarray.DataArray 'blue_curve' (time: 3)>
value_type: discrete, 'blue_curve': <xarray.DataArray 'blue_curve' (time: 3)>
array([0., 1., 3.])
Coordinates:
* time (time) datetime64[ns] 2019-12-15T10:17:33.408715 ... 2020-1...
spatial_ref int64 0
temporal_ref int64 0
Attributes:
value_type: numerical, 'green_curve': <xarray.DataArray 'green_curve' (time: 3)>
value_type: discrete, 'green_curve': <xarray.DataArray 'green_curve' (time: 3)>
array([ 0., 13., 6.])
Coordinates:
* time (time) datetime64[ns] 2019-12-15T10:17:33.408715 ... 2020-1...
spatial_ref int64 0
temporal_ref int64 0
Attributes:
value_type: numerical, 'blue_stat': <xarray.DataArray 'blue_stat' ()>
value_type: discrete, 'blue_stat': <xarray.DataArray 'blue_stat' ()>
array(4.)
Coordinates:
spatial_ref int64 0
temporal_ref int64 0
Attributes:
value_type: numerical, 'green_stat': <xarray.DataArray 'green_stat' ()>
value_type: discrete, 'green_stat': <xarray.DataArray 'green_stat' ()>
array(19.)
Coordinates:
spatial_ref int64 0
temporal_ref int64 0
Attributes:
value_type: numerical}
value_type: discrete}
50 changes: 25 additions & 25 deletions demo/gallery.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@
" &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,\n",
" initial-scale=1.0, maximum-scale=1.0, user-scalable=no&quot; /&gt;\n",
" &lt;style&gt;\n",
" #map_4ffee5093609754f7788bdb35a5b3771 {\n",
" #map_7f6271e8a0738c933068d7c9c458b80e {\n",
" position: relative;\n",
" width: 100.0%;\n",
" height: 100.0%;\n",
Expand Down Expand Up @@ -592,13 +592,13 @@
"&lt;/head&gt;\n",
"&lt;body&gt; \n",
" \n",
" &lt;div class=&quot;folium-map&quot; id=&quot;map_4ffee5093609754f7788bdb35a5b3771&quot; &gt;&lt;/div&gt;\n",
" &lt;div class=&quot;folium-map&quot; id=&quot;map_7f6271e8a0738c933068d7c9c458b80e&quot; &gt;&lt;/div&gt;\n",
" \n",
"&lt;/body&gt;\n",
"&lt;script&gt; \n",
" \n",
" var map_4ffee5093609754f7788bdb35a5b3771 = L.map(\n",
" &quot;map_4ffee5093609754f7788bdb35a5b3771&quot;,\n",
" var map_7f6271e8a0738c933068d7c9c458b80e = L.map(\n",
" &quot;map_7f6271e8a0738c933068d7c9c458b80e&quot;,\n",
" {\n",
" center: [47.32110812526405, 12.808509961311596],\n",
" crs: L.CRS.EPSG3857,\n",
Expand All @@ -607,77 +607,77 @@
" preferCanvas: false,\n",
" }\n",
" );\n",
" L.control.scale().addTo(map_4ffee5093609754f7788bdb35a5b3771);\n",
" L.control.scale().addTo(map_7f6271e8a0738c933068d7c9c458b80e);\n",
"\n",
" \n",
"\n",
" \n",
" \n",
" var tile_layer_6d512a78d532943fc2d5ab1856b05b6d = L.tileLayer(\n",
" var tile_layer_fc9775c18a2aa57295894fe8070c8e54 = L.tileLayer(\n",
" &quot;https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png&quot;,\n",
" {&quot;attribution&quot;: &quot;Data by \\u0026copy; \\u003ca href=\\&quot;http://openstreetmap.org\\&quot;\\u003eOpenStreetMap\\u003c/a\\u003e, under \\u003ca href=\\&quot;http://www.openstreetmap.org/copyright\\&quot;\\u003eODbL\\u003c/a\\u003e.&quot;, &quot;detectRetina&quot;: false, &quot;maxNativeZoom&quot;: 18, &quot;maxZoom&quot;: 18, &quot;minZoom&quot;: 0, &quot;noWrap&quot;: false, &quot;opacity&quot;: 1, &quot;subdomains&quot;: &quot;abc&quot;, &quot;tms&quot;: false}\n",
" ).addTo(map_4ffee5093609754f7788bdb35a5b3771);\n",
" ).addTo(map_7f6271e8a0738c933068d7c9c458b80e);\n",
" \n",
" \n",
" map_4ffee5093609754f7788bdb35a5b3771.fitBounds(\n",
" map_7f6271e8a0738c933068d7c9c458b80e.fitBounds(\n",
" [[47.30444420302901, 12.799052458545688], [47.33777204749909, 12.817967464077503]],\n",
" {}\n",
" );\n",
" \n",
" \n",
" function geo_json_764a59e248b3ef5e37943597e9c9a06c_styler(feature) {\n",
" function geo_json_33c5feaad0be1e6a127cbe224bc29f0b_styler(feature) {\n",
" switch(feature.id) {\n",
" default:\n",
" return {&quot;fillOpacity&quot;: 0.5, &quot;weight&quot;: 2};\n",
" }\n",
" }\n",
" function geo_json_764a59e248b3ef5e37943597e9c9a06c_highlighter(feature) {\n",
" function geo_json_33c5feaad0be1e6a127cbe224bc29f0b_highlighter(feature) {\n",
" switch(feature.id) {\n",
" default:\n",
" return {&quot;fillOpacity&quot;: 0.75};\n",
" }\n",
" }\n",
" function geo_json_764a59e248b3ef5e37943597e9c9a06c_pointToLayer(feature, latlng) {\n",
" function geo_json_33c5feaad0be1e6a127cbe224bc29f0b_pointToLayer(feature, latlng) {\n",
" var opts = {&quot;bubblingMouseEvents&quot;: true, &quot;color&quot;: &quot;#3388ff&quot;, &quot;dashArray&quot;: null, &quot;dashOffset&quot;: null, &quot;fill&quot;: true, &quot;fillColor&quot;: &quot;#3388ff&quot;, &quot;fillOpacity&quot;: 0.2, &quot;fillRule&quot;: &quot;evenodd&quot;, &quot;lineCap&quot;: &quot;round&quot;, &quot;lineJoin&quot;: &quot;round&quot;, &quot;opacity&quot;: 1.0, &quot;radius&quot;: 2, &quot;stroke&quot;: true, &quot;weight&quot;: 3};\n",
" \n",
" let style = geo_json_764a59e248b3ef5e37943597e9c9a06c_styler(feature)\n",
" let style = geo_json_33c5feaad0be1e6a127cbe224bc29f0b_styler(feature)\n",
" Object.assign(opts, style)\n",
" \n",
" return new L.CircleMarker(latlng, opts)\n",
" }\n",
"\n",
" function geo_json_764a59e248b3ef5e37943597e9c9a06c_onEachFeature(feature, layer) {\n",
" function geo_json_33c5feaad0be1e6a127cbe224bc29f0b_onEachFeature(feature, layer) {\n",
" layer.on({\n",
" mouseout: function(e) {\n",
" if(typeof e.target.setStyle === &quot;function&quot;){\n",
" geo_json_764a59e248b3ef5e37943597e9c9a06c.resetStyle(e.target);\n",
" geo_json_33c5feaad0be1e6a127cbe224bc29f0b.resetStyle(e.target);\n",
" }\n",
" },\n",
" mouseover: function(e) {\n",
" if(typeof e.target.setStyle === &quot;function&quot;){\n",
" const highlightStyle = geo_json_764a59e248b3ef5e37943597e9c9a06c_highlighter(e.target.feature)\n",
" const highlightStyle = geo_json_33c5feaad0be1e6a127cbe224bc29f0b_highlighter(e.target.feature)\n",
" e.target.setStyle(highlightStyle);\n",
" }\n",
" },\n",
" });\n",
" };\n",
" var geo_json_764a59e248b3ef5e37943597e9c9a06c = L.geoJson(null, {\n",
" onEachFeature: geo_json_764a59e248b3ef5e37943597e9c9a06c_onEachFeature,\n",
" var geo_json_33c5feaad0be1e6a127cbe224bc29f0b = L.geoJson(null, {\n",
" onEachFeature: geo_json_33c5feaad0be1e6a127cbe224bc29f0b_onEachFeature,\n",
" \n",
" style: geo_json_764a59e248b3ef5e37943597e9c9a06c_styler,\n",
" pointToLayer: geo_json_764a59e248b3ef5e37943597e9c9a06c_pointToLayer\n",
" style: geo_json_33c5feaad0be1e6a127cbe224bc29f0b_styler,\n",
" pointToLayer: geo_json_33c5feaad0be1e6a127cbe224bc29f0b_pointToLayer\n",
" });\n",
"\n",
" function geo_json_764a59e248b3ef5e37943597e9c9a06c_add (data) {\n",
" geo_json_764a59e248b3ef5e37943597e9c9a06c\n",
" function geo_json_33c5feaad0be1e6a127cbe224bc29f0b_add (data) {\n",
" geo_json_33c5feaad0be1e6a127cbe224bc29f0b\n",
" .addData(data)\n",
" .addTo(map_4ffee5093609754f7788bdb35a5b3771);\n",
" .addTo(map_7f6271e8a0738c933068d7c9c458b80e);\n",
" }\n",
" geo_json_764a59e248b3ef5e37943597e9c9a06c_add({&quot;bbox&quot;: [12.799052458545688, 47.30444420302901, 12.817967464077503, 47.33777204749909], &quot;features&quot;: [{&quot;bbox&quot;: [12.803868147852612, 47.33056389640604, 12.817967464077503, 47.33777204749909], &quot;geometry&quot;: {&quot;coordinates&quot;: [[[12.803868147852612, 47.33091868331674], [12.817596157332153, 47.33056389640604], [12.817967464077503, 47.33741720662344], [12.804237649967712, 47.33777204749909], [12.803868147852612, 47.33091868331674]]], &quot;type&quot;: &quot;Polygon&quot;}, &quot;id&quot;: &quot;0&quot;, &quot;properties&quot;: {&quot;name&quot;: &quot;Northern&quot;}, &quot;type&quot;: &quot;Feature&quot;}, {&quot;bbox&quot;: [12.799052458545688, 47.30444420302901, 12.815746431172713, 47.31514111553671], &quot;geometry&quot;: {&quot;coordinates&quot;: [[[12.799052458545688, 47.30486091070503], [12.815190335969971, 47.30444420302901], [12.815746431172713, 47.3147243128484], [12.799605373818284, 47.31514111553671], [12.799052458545688, 47.30486091070503]]], &quot;type&quot;: &quot;Polygon&quot;}, &quot;id&quot;: &quot;1&quot;, &quot;properties&quot;: {&quot;name&quot;: &quot;Southern&quot;}, &quot;type&quot;: &quot;Feature&quot;}], &quot;type&quot;: &quot;FeatureCollection&quot;});\n",
" geo_json_33c5feaad0be1e6a127cbe224bc29f0b_add({&quot;bbox&quot;: [12.799052458545688, 47.30444420302901, 12.817967464077503, 47.33777204749909], &quot;features&quot;: [{&quot;bbox&quot;: [12.803868147852612, 47.33056389640604, 12.817967464077503, 47.33777204749909], &quot;geometry&quot;: {&quot;coordinates&quot;: [[[12.803868147852612, 47.33091868331674], [12.817596157332153, 47.33056389640604], [12.817967464077503, 47.33741720662344], [12.804237649967712, 47.33777204749909], [12.803868147852612, 47.33091868331674]]], &quot;type&quot;: &quot;Polygon&quot;}, &quot;id&quot;: &quot;0&quot;, &quot;properties&quot;: {&quot;name&quot;: &quot;Northern&quot;}, &quot;type&quot;: &quot;Feature&quot;}, {&quot;bbox&quot;: [12.799052458545688, 47.30444420302901, 12.815746431172713, 47.31514111553671], &quot;geometry&quot;: {&quot;coordinates&quot;: [[[12.799052458545688, 47.30486091070503], [12.815190335969971, 47.30444420302901], [12.815746431172713, 47.3147243128484], [12.799605373818284, 47.31514111553671], [12.799052458545688, 47.30486091070503]]], &quot;type&quot;: &quot;Polygon&quot;}, &quot;id&quot;: &quot;1&quot;, &quot;properties&quot;: {&quot;name&quot;: &quot;Southern&quot;}, &quot;type&quot;: &quot;Feature&quot;}], &quot;type&quot;: &quot;FeatureCollection&quot;});\n",
"\n",
" \n",
" \n",
" geo_json_764a59e248b3ef5e37943597e9c9a06c.bindTooltip(\n",
" geo_json_33c5feaad0be1e6a127cbe224bc29f0b.bindTooltip(\n",
" function(layer){\n",
" let div = L.DomUtil.create(&#x27;div&#x27;);\n",
" \n",
Expand All @@ -703,7 +703,7 @@
"&lt;/script&gt;\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
"<folium.folium.Map at 0x7f7e076c49a0>"
"<folium.folium.Map at 0x7f47f74a1640>"
]
},
"execution_count": 16,
Expand Down
Loading

0 comments on commit 2244625

Please sign in to comment.