Skip to content

Instantly share code, notes, and snippets.

@diodon
diodon / gist:048925b055a24b7820bcde2db2be3c2a
Last active January 8, 2024 04:45
AIMS temp logger parquet data suit of tests
## TEST AIMS temp parquet partition
## Each test will run n times
## return: vector of executing time for each run
## libraries
library(arrow)
library(dplyr)
library(lubridate)
@diodon
diodon / gist:9c00235c4e7aefd02c7fca9db03bda62
Last active August 8, 2022 02:44
RIMReP/DMS Organisation Diagram
graph TD
A[Project Leader]
B[fa:fa-code Dev Lead]
C[fa:fa-table Data Lead]
A0[Admin]
A --> B
A --> C
B --> D[fa:fa-cloud Cloud Eng]
B --> E[fa:fa-code DevOps]
@diodon
diodon / gorgonaMBON.Rmd
Last active August 20, 2021 07:08
OBIS: ejemplo de como trabajar con MoF usando el paquete robis. Curso OBIS 2021. Modulo 4 1.7
---
title: "Cobertura de Algas en Isla Gorgona"
author: 'E. Klein'
date: "2021-08-20"
output:
html_document:
toc: TRUE
toc_float: TRUE
theme: united
highlight: tango
@diodon
diodon / getSMFlorideophyceae.R
Last active August 20, 2021 01:42
OBIS: obtener tabla de ocurrencia de especies para la región de Santa Marta, Colombia y hacer un mapa de los sitios. Curso OBIS Módulo 4 sección 1.6
library(robis)
## Define the Region of Interest
SMwkt <- "POLYGON ((-74.39941 11.21882, -74.29779 11.42349, -73.99292 11.46387, -73.89679 11.37772, -73.96271 11.24306, -74.15222 11.16493,
-74.33624 11.13259, -74.39941 11.21882))"
## Get the occurrence records for the ROI
SMocc <- occurrence(geometry = SMwkt)
## get the numero of different scientific names
@diodon
diodon / getSantaMartaspp.R
Last active August 20, 2021 00:13
OBIS: obtener el listado de especies para la región de Santa Marta, Colombia y hacer un gráfico de barra. Curso OBIS Módulo 4 sección 1.5
library(robis)
library(ggplot2)
library(forcats)
SMwkt <- "POLYGON ((-74.39941 11.21882, -74.29779 11.42349, -73.99292 11.46387, -73.89679 11.37772, -73.96271 11.24306, -74.15222 11.16493,
-74.33624 11.13259, -74.39941 11.21882))"
SMspp <- checklist(geometry = SMwkt)
## make table
taxaTBL <- table(SMspp$taxonRank)
@diodon
diodon / getAccumExposure.R
Last active August 3, 2021 02:38
HeatAccumulation: calculate BK curve
getAcumExposure = function(ts, tmin=27.5, tinc=1){
## calculate accumulated exposure
## this version does not have gaps in temp bins
## ts is a times series of daily values
## tmin is the starint temp to accumulate
## tinc is the number of decimal places to round temperature
## removes NA's
ts = ts[!is.na(ts)]
ts = ts[ts>=tmin]
@diodon
diodon / AIMSweather_latestreadings.py
Last active June 8, 2021 07:58
Get latest readings from an AIMS weather station, provided the station ID
import warnings
warnings.filterwarnings('ignore')
import json
import requests
import numpy as np
import prettytable
from sparklines import sparklines
def WSsummary(site):
@diodon
diodon / AIMSweather_stationID.py
Created June 8, 2021 07:38
Finding the AIMS weather station ID is necessary to get data from the instruments. This function returns the station name, ID and its metadata URL
## Get AIMS weather Station ID, name and metadata record link
import json
import requests
import prettytable
AIMSurl = "https://api.aims.gov.au/weather/latestreadings"
WSjson = json.loads(requests.get(AIMSurl).text)
tbl = prettytable.PrettyTable(['Station Name', "Station ID", "Metadata url"])
for station in range(len(WSjson)):
@diodon
diodon / AIMSweather_status.py
Last active June 8, 2021 07:33
Get the online status of AIMS weather stations
import json
import requests
import prettytable
## get the latest data using AIMS WS wer service
AIMSurl = "https://api.aims.gov.au/weather/latestreadings"
WSjson = json.loads(requests.get(AIMSurl).text)
## print the online status of each of the stations