No project description provided
Project description
Mortar Data (Serverless)
Install with pip install mortardata
Set the following environment variables:
export MORTARDATA_S3_REGION=""
export MORTARDATA_S3_BUCKET=""
export MORTARDATA_QUERY_ENDPOINT=""
Then use as follows:
from mortardata import Client
# connect client
c = Client()
vav_points = """
PREFIX brick: <https://brickschema.org/schema/Brick#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX ref: <https://brickschema.org/schema/Brick/ref#>
SELECT ?equip ?point ?id WHERE {
?equip rdf:type/rdfs:subClassOf* brick:VAV ;
brick:hasPoint ?point .
?point ref:hasExternalReference/ref:hasTimeseriesId ?id .
}"""
# get metadata for first 20 sites
df = c.sparql(vav_points, sites=c.sites[:20])
# most operations return dataframes
df.to_csv("vav_points.csv")
# get timeseries data into a dataframe for 2 sites, maximum of 1 million points for January 2016
df = c.data_sparql(vav_points, start="2016-01-01", end="2016-02-01", limit=1e6, sites=['urn:bldg2#','urn:bldg5#'])
print(df.head())
# similar to the above, but streams data directly into a CSV file. Can be helpful for extra large downloads
num = c.data_sparql_to_csv(vav_points, "vav_data.csv", limit=1e6, sites=['urn:bldg2#','urn:bldg5#'])
print(f"Downloaded {num} datapoints")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mortardata-0.1.7a1.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for mortardata-0.1.7a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa48e746b7022de9c215dc0ffb12de0e6df83f9b68ec26ff935de7a6d2f4c3f5 |
|
MD5 | 1903e98833c7c1af405a7b4370c2338a |
|
BLAKE2b-256 | 1d2151d6462fe37744b2af169c6ff0c24e258921a7bae656522950c437dc74c1 |