Skip to content

Instantly share code, notes, and snippets.

View monkeybutter's full-sized avatar

Pablo Rozas-Larraondo monkeybutter

  • National Computational Infrastructure
  • Canberra
View GitHub Profile
@monkeybutter
monkeybutter / pyGDALite.py
Created October 10, 2016 23:03
Python light GDAL wrapper
from osgeo import gdal, osr, ogr
import numpy as np
from PIL import Image
from PIL import ImageOps
gdal2np_types = {gdal.GDT_UInt16: '<u2',
gdal.GDT_Float32: '<f4'}
np2gdal_types = {'<u2': gdal.GDT_UInt16,
'<f4':gdal.GDT_Float32}
package main
import (
"fmt"
)
type Doer interface {
doSomething(string)
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
package main
import (
"os/exec"
"encoding/json"
"os"
"bufio"
"fmt"
"strings"
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
import h5py
def create_random_table(file_name, table_name, num_rows, chunk_size):
with h5py.File(file_name, "w") as f:
a = np.random.randint(0, 1e3, size=(num_rows,), dtype=np.int32)
b = np.random.normal(0, .1, size=(num_rows,))
contents = np.zeros(shape=(num_rows,), dtype=[('A', 'i4'),('B', 'f8')])
contents['A'] = a
package main
import (
"fmt"
"math/rand"
"time"
)
func FeedStream(buf chan int, n int) {
time.Sleep(1500 * time.Millisecond)
@monkeybutter
monkeybutter / xtrss_thredds.go
Created July 29, 2016 03:30
A tool measure performance of THREDDS under stress
package main
import (
"fmt"
"log"
"flag"
"time"
"sync"
"strings"
"io/ioutil"
#include "gdal.h"
#include "cpl_conv.h" // for CPLMalloc()
#include "gdal_alg.h"
#include <stdio.h>
int main(int argc, char *argv[]) {
GDALAllRegister();
//Source Dataset from NetCDF
GDALDatasetH hDataset;
package main
import (
"encoding/xml"
"fmt"
"net/http"
)
var input string = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE WMT_MS_Capabilities SYSTEM "http://giswebservices.massgis.state.ma.us/geoserver/schemas/wms/1.1.1/WMS_MS_Capabilities.dtd">