Skip to content

Instantly share code, notes, and snippets.

@ghalimi ghalimi/quakes.json
Created Sep 28, 2015

Embed
What would you like to do?
{
"name" : "Quakes",
"id" : "/quakes",
"version" : "0.0.1",
"description" : "All recorded earthquakes with a magnitude of 6 or greater from 1900 to 2013.",
"author" : "Ismael Chang Ghalimi @ghalimi",
"license" : "MIT",
"sheets" : [
{
"name" : "Recordings",
"id" : "recordings",
"type" : "data",
"spec" : {
"parameters" : [
{
"name" : "Equator",
"id" : "equator",
"datatype" : "number",
"typology" : "directional",
"default" : 0
}
],
"datasources" : ["/resources/csv/earthquakes.csv"],
"columns" : [
{
"name" : "ID",
"id" : "id",
"datatype" : "identifier",
"typology" : "nominal",
"options" : { "size": 32 }
},
{
"name" : "Network",
"id" : "network",
"datatype" : "category",
"typology" : "nominal",
"options" : {
"categories" : [
{ "name": "Atlas" , "id": 0 },
{ "name": "Centennial", "id": 1 },
{ "name": "NC" , "id": 2 },
{ "name": "Official" , "id": 3 },
{ "name": "PDE" , "id": 4 },
{ "name": "US" , "id": 5 }
]
}
},
{
"name" : "Country",
"id" : "country",
"datatype" : "string",
"typology" : "nominal",
"options" : { "size": 64 }
},
{
"name" : "Place",
"id" : "place",
"datatype" : "string",
"typology" : "nominal",
"options" : { "size": 64 }
},
{
"name" : "Timestamp",
"id" : "timestamp",
"datatype" : "timestamp",
"typology" : "incremental"
},
{
"name" : "Date",
"id" : "date",
"datatype" : "date",
"typology" : "incremental",
"options" : {}
},
{
"name" : "Time",
"id" : "time",
"datatype" : "time",
"typology" : "sectorial"
},
{
"name" : "Updated",
"id" : "updated",
"datatype" : "timestamp",
"typology" : "incremental"
},
{
"name" : "Latitude",
"id" : "latitude",
"datatype" : "number",
"typology" : "directional"
},
{
"name" : "Longitude",
"id" : "longitude",
"datatype" : "number",
"typology" : "directional"
},
{
"name" : "Depth",
"id" : "depth",
"datatype" : "number",
"typology" : "intensive"
},
{
"name" : "Magnitude",
"id" : "magnitude",
"datatype" : "number",
"typology" : "intensive"
},
{
"name" : "Type",
"id" : "type",
"datatype" : "category",
"typology" : "nominal",
"options" : {
"categories" : [
{ "name": "MB" , "id": 0 },
{ "name": "MJ" , "id": 1 },
{ "name": "MS" , "id": 2 },
{ "name": "MT" , "id": 3 },
{ "name": "MW" , "id": 4 },
{ "name": "MWB", "id": 5 },
{ "name": "MWC", "id": 6 },
{ "name": "MWP", "id": 7 },
{ "name": "MWR", "id": 8 },
{ "name": "MWW", "id": 9 },
{ "name": "UK" , "id": 10 }
]
}
},
{
"name" : "Reports",
"id" : "reports",
"datatype" : "integer",
"typology" : "cardinal"
},
{
"name" : "Gap",
"id" : "gap",
"datatype" : "number",
"typology" : "directional"
},
{
"name" : "Distance",
"id" : "distance",
"datatype" : "number",
"typology" : "intensive"
},
{
"name" : "RMS",
"id" : "rms",
"datatype" : "number",
"typology" : "intensive"
},
{
"name" : "Hemisphere",
"id" : "hemisphere",
"datatype" : "category",
"typology" : "nominal",
"options" : {
"categories" : [
{ "name": "North", "id": "north" },
{ "name": "South", "id": "south" }
]
},
"equation" : "IF(latitude > equator, 'north', 'south')"
},
{
"name" : "Year",
"id" : "year",
"datatype" : "integer",
"typology" : "incremental",
"equation" : { "year": ["timestamp"] }
}
],
"blueprint" : {
"visual" : "scatter",
"measures" : [
{
"variable" : "latitude",
"axis" : "horizontal"
},
{
"variable" : "longitude",
"axis" : "vertical"
},
{
"variable" : "magnitude",
"axis" : "color",
"palette" : {
"name" : "OrRd",
"number" : 4
}
}
],
"options" : {
"symbol" : "disk",
"projection" : "mercator",
"note" : {
"html" : "<strong>Source:</strong> USGS"
}
}
},
"filter" : [
{
"type" : "expression",
"format" : "binary",
"variant" : "operation",
"operation" : "!=",
"left" : {
"type" : "identifier",
"variant" : "column",
"name" : "network"
},
"right" : {
"type" : "literal",
"variant" : "string",
"value" : "Atlas"
}
}
],
"views" : [
{
"name" : "Earthquakes by Network",
"id" : "earthquakes_by_network",
"function" : "PIVOT",
"arguments" : [
"recordings",
{
"dimensions" : {
"cols" : ["network", "hemisphere"],
"rows" : []
},
"measures" : [
{
"column" : "magnitude",
"summary" : "average",
"format" : { "background": null, "text": null, "value": ",.1f", "css": null }
}
],
"blueprint" : {
"visual" : "bar",
"dimensions" : {
"columns" : {
"visualized" : {
"variable" : "network",
"axis" : "horizontal",
"cohorts" : { "variable": "hemisphere" }
}
}
},
"measures" : [
{
"variable" : "average_magnitude",
"axis" : "height"
}
],
"options" : {
"description" : {
"html" : "<strong>Description</strong><br>Hemisphere: <code>IF(latitude >= equator, 'north', 'south')</code>",
"height" : "5em"
},
"note" : {
"html" : "<strong>Source:</strong> USGS"
}
}
}
}
]
},
{
"name" : "Earthquakes by Network and Type",
"id" : "earthquakes_by_network_and_type",
"filter" : [
{
"type" : "expression",
"format" : "binary",
"variant" : "operation",
"operation" : "and",
"left" : {
"type" : "expression",
"format" : "binary",
"variant" : "operation",
"operation" : "!=",
"left" : {
"type" : "identifier",
"variant" : "column",
"name" : "network"
},
"right" : {
"type" : "identifier",
"variant" : "column",
"name" : "Atlas"
}
},
"right" : {
"type" : "expression",
"format" : "binary",
"variant" : "operation",
"operation" : ">",
"left" : {
"type" : "function",
"name" : "day",
"distinct" : false,
"args" : [
{
"type" : "identifier",
"variant" : "column",
"name" : "date"
}
]
},
"right" : {
"type" : "literal",
"variant" : "decimal",
"value" : "40998"
}
}
}
],
"function" : "PIVOT",
"arguments" : [
"recordings",
{
"dimensions" : {
"cols" : ["network", "type"],
"rows" : []
},
"measures" : [
{
"column" : "depth",
"summary" : "average",
"format" : { "background": null, "text": null, "value": ",.1f", "css": null }
}
],
"blueprint" : {
"visual" : "bar",
"dimensions" : {
"columns" : {
"visualized" : {
"variable" : "type",
"axis" : "horizontal"
}
}
},
"measures" : [
{
"variable" : "average_depth",
"axis" : "height",
"details" : {
"variable" : "network",
"type" : "stack"
}
}
],
"options" : {
"note" : {
"html" : "<strong>Source:</strong> USGS"
}
}
}
}
]
},
{
"name" : "Magnitude Drop",
"id" : "drop",
"function" : "PIVOT",
"arguments" : [
"recordings",
{
"dimensions" : {
"cols" : ["year"],
"rows" : []
},
"measures" : [
{
"column" : "magnitude",
"summary" : "average"
}
],
"blueprint" : {
"visual" : "line",
"dimensions" : {
"columns" : {
"visualized" : {
"variable" : "year",
"axis" : "horizontal",
"scale" : "linear",
"format" : "d",
"values" : [1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000, 2010, 2020]
}
}
},
"measures" : [
{
"variable" : "average_magnitude",
"axis" : "vertical",
"values" : [6, 7, 8]
}
],
"options" : {
"description" : {
"html" : "<strong>Description</strong><br>Year computed with <code>YEAR(timestamp)</code>",
"height" : "5em"
},
"note" : {
"html" : "<strong>Source:</strong> USGS"
}
}
}
}
]
},
{
"name" : "Earthquakes Heatmap",
"id" : "earthquakes_heatmap",
"function" : "PIVOT",
"arguments" : [
"recordings",
{
"dimensions" : {
"cols" : ["network", "type"],
"rows" : []
},
"measures" : [
{
"column" : "depth",
"summary" : "average",
"format" : { "background": null, "text": null, "value": ",.1f", "css": null }
}
],
"blueprint" : {
"visual" : "heatmap",
"dimensions" : {
"columns" : {
"visualized" : {
"variable" : "network",
"axis" : "horizontal"
}
},
"rows" : {
"visualized" : {
"variable" : "type",
"axis" : "vertical"
}
}
},
"measures" : [
{
"variable" : "average_depth",
"axis" : "color"
}
],
"options" : {
"note" : {
"html" : "<strong>Source:</strong> USGS"
}
}
}
}
]
}
]
}
},
{
"name" : "Magnitude Autocorrelation",
"id" : "autocorrelation",
"type" : "data",
"spec" : {
"columns" : [
{
"name" : "Lag",
"id" : "lag",
"datatype" : "integer",
"typology" : "arrival",
"equation" : "row + 1"
},
{
"name" : "Autocorrelation",
"id" : "autocorrelation",
"datatype" : "number",
"typology" : "intensive",
"equation" : "AUTOCORRELATION('recordings', magnitude, row + 1, FALSE)"
}
],
"rows" : 100,
"blueprint" : {
"visual" : "level",
"dimensions" : {
"columns" : {
"visualized" : {
"variable" : "lag",
"axis" : "horizontal"
}
}
},
"measures" : [
{
"variable" : "autocorrelation",
"axis" : "vertical"
}
],
"options" : {
"symbol" : "disk",
"note" : {
"html" : "<strong>Source:</strong> USGS"
}
}
}
}
},
{
"name" : "Notebook",
"id" : "notebook",
"type" : "notebook",
"spec" : {
"operations" : [
{
"type" : "docs",
"id" : "lorem",
"spec" : { "code": "Lorem ipsum dolor" }
},
{
"type" : "code",
"id" : "42",
"spec" : { "code": "6 * 7" }
}
]
}
},
{
"name" : "Dashboard",
"id" : "dashboard",
"type" : "dashboard",
"spec" : {
"cells" : {
"0" : {
"0" : {
"text" : "=PLOT('recordings/analysis')",
"colspan" : 6,
"rowspan" : 12
},
"6" : {
"text" : "=PLOT('recordings/drop')",
"colspan" : 5,
"rowspan" : 12
}
}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.