Skip to content

Instantly share code, notes, and snippets.

View adamml's full-sized avatar

Adam Leadbetter adamml

View GitHub Profile
@adamml
adamml / waves_blender.py
Created September 1, 2022 21:06
Render wave time series from Erddap in Blender
import json
import bmesh
import urllib.request
import datetime
import math
def drawpolygon(xdata, ydata,
xnorm = None, ynorm=None, zscale=None, colour=(1, 1, 1, 1)):
if xnorm is not None:
xdata = list(map(lambda x, seriesmax=max(xdata), seriesmin=min(xdata), norm=xnorm: (((x - seriesmin)/(seriesmax - seriesmin)) * (norm[1]-norm[0])) + norm[0], xdata))
@adamml
adamml / valentia.ipynb
Created June 25, 2022 14:58
Exploring the Valentia Observatory Monthly Data time-series
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adamml
adamml / requirements.txt
Last active May 29, 2022 20:01
Tour de France villes etape data exploration / map builder
matplotlib
@adamml
adamml / nvs_collection_to_owl_named_individuals.py
Last active May 9, 2022 15:25
NERC Vocabulary Server Concept Collection to OWL Named Individuals
import urllib.request
from rdflib import Graph, Literal, OWL, RDF, RDFS, URIRef, SKOS
import rdflib.namespace
def nvs_fetcher(nvs_collection: str, others: list) -> Graph:
"""Fetches a NERC Vocabulary server collection and returns it
as a set of OWL Named Individuals with optional additional OWL or
RDF classes added to the graph.
@adamml
adamml / query.rq
Last active November 13, 2019 15:48
NVS Hierarchy
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT DISTINCT ?url ?label ?date WHERE
{
{
SELECT (?a AS ?url) (?c AS ?label)
WHERE {
VALUES ?a {<http://vocab.nerc.ac.uk/collection/P01/current/PSALCU01/> <http://vocab.nerc.ac.uk/collection/P01/current/ALATZZ01/>}
?a skos:prefLabel ?c
@adamml
adamml / nvsP01query.rq
Last active May 16, 2019 09:17
Search the P01 Vocabu;lary on the NERC Vocabulary Server
PREFIX dc:<http://purl.org/dc/elements/1.1/>
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?p ?q WHERE {
<http://vocab.nerc.ac.uk/collection/P01/current/> rdf:type skos:Collection.
<http://vocab.nerc.ac.uk/collection/P01/current/> ?o ?p.
?p skos:prefLabel ?q
FILTER REGEX(lcase(str(?q)), "solar")
}
@adamml
adamml / eg.json
Last active November 10, 2017 01:07
Casting a SKOS Concept to Schema.org
{
"@context": "http://schema.org",
"@type": "Thing",
"identifier": {
"@id": "http://vocab.nerc.ac.uk/collection/L05/current/134/",
"@type": ["PropertyValue", "CreativeWork"],
"name": "water temperature sensor",
"value": "water temperature sensor",
"description": "An instrument that measures the temperature of the water with which it is in contact.",
"alternateName": "",
@adamml
adamml / ocean-expert.json
Last active October 6, 2017 12:51
OceanExpert modelling in Schema
{
"@context": {
"sc": "http://schema.org/",
"gl":"http://schema.geolink.org/1.0/base/main#",
"skos": "http://www.w3.org/2004/02/skos/core#"
},
"@id": "https://www.oceanexpert.net/expert/20699",
"@type": "sc:Person",
"sc:additionalType": "gl:Person",
"sc:honorificPrefix": "Dr.",
@adamml
adamml / GetCreatorEditorAndDate.js
Created April 12, 2017 14:22
SharePoint Online: Wiki Page - Created on; Last modified by; Last Modified on
function GetCreatorEditorAndDates()
{
var relativePageURL = _spPageContextInfo.serverRequestPath;
var siteURL = _spPageContextInfo.webAbsoluteUrl;
var profileUrl = "http://mysites.MYCOMPANY.com/Person.aspx?accountname="; <!-- fill in with your own mysites/profile url -->
@adamml
adamml / eg.tex
Created August 19, 2016 14:48
LaTeX list style for Grok syntax highlighting
\lstdefinelanguage{Grok}{
keywords={NUMBER, SPACE, TIME, MONTHNUM,MONTHDAY,TIMESTAMP_ISO8601,INT,MI_INST,MI_PREFIX,IDRONAUT_OCEAN7_304,WETLABS_ECO_FLNTU_3137},
keywordstyle=\color{blue}\bfseries,
ndkeywords={float, time, integer, timestamp},
ndkeywordstyle=\color{green}\bfseries,
comment=[l]{\#},
commentstyle=\color{purple}\ttfamily,
identifierstyle=\color{red}\ttfamily,
}