Skip to content

Instantly share code, notes, and snippets.

Fabian Gans meggart

  • Max-Planck-Institute for Biogeochemistry
  • Jena, Germany
Block or report user

Report or block meggart

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@meggart
meggart / gist:e29e6381d9400ff789eefbccc109d6f9
Last active Oct 7, 2019
DimensionalData interface proposal.md
View gist:e29e6381d9400ff789eefbccc109d6f9
using DimensionalData
using GeoData
# Functions to be extended
"""
    gridcoordinates(::Gridtype,x)
@meggart
meggart / Pangeo.ipynb
Created Sep 18, 2019
Example of using ESDL with Pangeo data
View Pangeo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@meggart
meggart / parseprj.jl
Created Aug 20, 2019
Parse prj from Shapefile
View parseprj.jl
import Tokenize.Tokens: IDENTIFIER, LSQUARE, COMMA, RSQUARE, STRING, ENDMARKER
function parsetokens(t,ar)
if t[1].kind==Tokenize.Tokens.IDENTIFIER
@assert t[2].kind==LSQUARE
brackcount=1
i=3
while true
t[i].kind==LSQUARE && (brackcount=brackcount+1)
t[i].kind==RSQUARE && (brackcount=brackcount-1)
brackcount==0 && break
View Dockerfile
FROM jupyter/datascience-notebook:eb149a8c333a
MAINTAINER dev@brockmann-consult.de
LABEL version='0.6.1'
USER root
RUN sudo apt-get update && sudo apt-get upgrade -y
RUN sudo apt-get install -y git unzip apt-utils vim
ADD start.sh /usr/local/bin/start.sh
View gist:ef7de95a11cd480e10d1971dc3d1c58e
This file has been truncated, but you can view the full file.
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
View ZarrTutorial.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View broadcast_iterator.jl
"""
broadcast_reduce(f,op,v0,A,Bs...)
Should behave like mapreduce, with the only difference that singleton dimension are expanded like in broadcast.
"""
function broadcast_reduce(f,op,v0,A,Bs...)
shape = Base.Broadcast.broadcast_indices(A,Bs...)
iter = CartesianRange(shape)
keeps, Idefaults = Base.Broadcast.map_newindexer(shape, A, Bs)
_broadcast_reduce(f,op,v0,keeps,Idefaults,A, Bs,Val{length(Bs)}(),iter)
View maketable.py
import cablab
from cablab import cube_gen
from cablab import cube_config
from collections import OrderedDict
from textwrap import TextWrapper
class varInfo:
def __init__(self):
plist = cube_gen._load_source_providers()
plist.pop('test')
@meggart
meggart / tinytestcubecube.py
Created Jan 5, 2016
A draft for a tiny test data cube that can be used for unit testing the Data Access APIs in different languages.
View tinytestcubecube.py
from datetime import datetime, timedelta
from cablab import Cube, CubeConfig, CubeSourceProvider
import numpy
class MiniCubeProvider(CubeSourceProvider):
def __init__(self, cube_config):
if cube_config.grid_width != 6 or cube_config.grid_height != 3:
raise ValueError('illegal cube configuration, cube dimension must be 6x3')
View Conda_verion.jl
"Get the exact version of a package."
function version(name::AbstractString)
packages = JSON.parse(readall(`$conda list --json`))
for package in packages
if startswith(package, name)
return package
end
end
warn("Could not find the $name package")
return "Not found"
You can’t perform that action at this time.