forked from cmudig/mosaic
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
create ast to python and convert all examples into python
- Loading branch information
1 parent
bc10d61
commit d6ad7a5
Showing
95 changed files
with
9,640 additions
and
99 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
from mosaic_spec import * | ||
from typing import Dict, Any, Union | ||
|
||
spec = { | ||
"meta": { | ||
"title": "Aeromagnetic Survey", | ||
"description": "A raster visualization of the 1955 [Great Britain aeromagnetic survey](https://www.bgs.ac.uk/datasets/gb-aeromagnetic-survey/), which measured the Earth’s magnetic field by plane. Each sample recorded the longitude and latitude alongside the strength of the [IGRF](https://www.ncei.noaa.gov/products/international-geomagnetic-reference-field) in [nanoteslas](https://en.wikipedia.org/wiki/Tesla_(unit)). This example demonstrates both raster interpolation and smoothing (blur) options.\n", | ||
"credit": "Adapted from an [Observable Plot example](https://observablehq.com/@observablehq/plot-igfr90-raster)." | ||
}, | ||
"data": { | ||
"ca55": { | ||
"type": "parquet", | ||
"file": "data/ca55-south.parquet" | ||
} | ||
}, | ||
"params": { | ||
"interp": "random-walk", | ||
"blur": 0 | ||
}, | ||
"vconcat": [ | ||
{ | ||
"hconcat": [ | ||
{ | ||
"input": "menu", | ||
"label": "Interpolation Method", | ||
"options": [ | ||
"none", | ||
"nearest", | ||
"barycentric", | ||
"random-walk" | ||
], | ||
"as": "$interp" | ||
}, | ||
{ | ||
"hspace": "1em" | ||
}, | ||
{ | ||
"input": "slider", | ||
"label": "Blur", | ||
"min": 0, | ||
"max": 100, | ||
"as": "$blur" | ||
} | ||
] | ||
}, | ||
{ | ||
"vspace": "1em" | ||
}, | ||
{ | ||
"plot": [ | ||
{ | ||
"mark": "raster", | ||
"data": { | ||
"from": "ca55" | ||
}, | ||
"x": "LONGITUDE", | ||
"y": "LATITUDE", | ||
"fill": { | ||
"max": "MAG_IGRF90" | ||
}, | ||
"interpolate": "$interp", | ||
"bandwidth": "$blur" | ||
} | ||
], | ||
"colorScale": "diverging", | ||
"colorDomain": "Fixed" | ||
} | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
from mosaic_spec import * | ||
from typing import Dict, Any, Union | ||
|
||
spec = { | ||
"meta": { | ||
"title": "Airline Travelers", | ||
"description": "A labeled line chart comparing airport travelers in 2019 and 2020.", | ||
"credit": "Adapted from an [Observable Plot example](https://observablehq.com/@observablehq/plot-labeled-line-chart)." | ||
}, | ||
"data": { | ||
"travelers": { | ||
"type": "parquet", | ||
"file": "data/travelers.parquet" | ||
}, | ||
"endpoint": { | ||
"type": "table", | ||
"query": "SELECT * FROM travelers ORDER BY date DESC LIMIT 1" | ||
} | ||
}, | ||
"plot": [ | ||
{ | ||
"mark": "ruleY", | ||
"data": [ | ||
0 | ||
] | ||
}, | ||
{ | ||
"mark": "lineY", | ||
"data": { | ||
"from": "travelers" | ||
}, | ||
"x": "date", | ||
"y": "previous", | ||
"strokeOpacity": 0.35 | ||
}, | ||
{ | ||
"mark": "lineY", | ||
"data": { | ||
"from": "travelers" | ||
}, | ||
"x": "date", | ||
"y": "current" | ||
}, | ||
{ | ||
"mark": "text", | ||
"data": { | ||
"from": "endpoint" | ||
}, | ||
"x": "date", | ||
"y": "previous", | ||
"text": [ | ||
"2019" | ||
], | ||
"fillOpacity": 0.5, | ||
"lineAnchor": "bottom", | ||
"dy": -6 | ||
}, | ||
{ | ||
"mark": "text", | ||
"data": { | ||
"from": "endpoint" | ||
}, | ||
"x": "date", | ||
"y": "current", | ||
"text": [ | ||
"2020" | ||
], | ||
"lineAnchor": "top", | ||
"dy": 6 | ||
} | ||
], | ||
"yGrid": True, | ||
"yLabel": "↑ Travelers per day", | ||
"yTickFormat": "s" | ||
} |
Oops, something went wrong.