Skip to content

Instantly share code, notes, and snippets.

View betodealmeida's full-sized avatar
💭
Code code code

Beto Dealmeida betodealmeida

💭
Code code code
View GitHub Profile
@betodealmeida
betodealmeida / sandy.jnl
Created December 4, 2012 08:13
Ferret Sandy hurricane test
yes? USE "http://example.com/dap/u/token/id ! use your URL here
yes? show data
currently SET data sets:
1> http://localhost:8081/sandy (default)
name title I J K L M N
OCEAN_TEMPERATURE
Seawater temperature 1:15104 1:7936 ... 1:4 ... ...
INSITU.STID
1:590 ... ... ... ... ...
INSITU.LAT
{
"metadata": {
"name": "Untitled0"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
from pydap.handlers.lib import get_handler
from django_wsgi import django_view
filepath = XXX # get this from the model somehow
handler = get_handler(filepath) # this is a WSGI app
view = django_view(handler)
return view(request)
from pydap.handlers.lib import get_handler
from django_wsgi import django_view
filepath = XXX # get this from the model somehow
handler = get_handler(filepath) # this is a WSGI app
view = django_view(handler)
return view(request)
from pydap.parsers.dds import DDSParser
from pydap.parsers.das import DASParser
from pydap.xdr import DapUnpacker
f = open("/path/to/file.dods")
content = f.read()
dds, xdrdata = content.split('\nData:\n', 1)
# build the dataset
dataset = DDSParser(dds).parse()
words = { word.strip(): None for word in open('/usr/share/dict/words') }
four = [word for word in words.keys() if len(word) == 4]
for left in four:
for right in four:
combined = ''.join([ left[j] + right[j] for j in range(4) ])
for word in words:
if not combined.startswith(word):
continue
rest = combined[len(word):]
import requests
class RemoteFile(object):
def __init__(self, url):
self.url = url
self.position = 0
def tell(self):
return self.position
import os
import urllib
from ftplib import FTP
import socket
from pupynere import netcdf_file
class FTPFile(object):
def __init__(self, url, buffer=4096):
#!/bin/bash
#
# By Sirupsen @ http://sirupsen.dk
#
# Description: Very simple script to make you
# select a region of your screen, which will be captured, and
# then uploaded. The URL will then be injected into your clipboard.
#
# Dependencies:
#
@betodealmeida
betodealmeida / gist:5384520
Created April 14, 2013 22:35
Streaming data via OPeNDAP
from pydap.model import *
from pydap.handlers.lib import IterData, BaseHandler
class SensorData(IterData):
"""
Sensor data as a structured array like object.
"""
def gen(self):