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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import netCDF4
from datetime import datetime
import pytz
import numpy as np
with netCDF4.Dataset("a_FMC_File.nc", 'r+', format='NETCDF4') as src:
temp = np.zeros(src["time"].shape)
for i, t in enumerate(src["time"]):
d_local = datetime.fromtimestamp(t)
t_utc = (pytz.utc.localize(d_local)-pytz.utc.localize(datetime(1970,1,1))).total_seconds()
package main
// #include "gdal.h"
// #include "gdal_alg.h"
// #include "ogr_api.h"
// #include "ogr_srs_api.h"
// #include "cpl_string.h"
// #cgo LDFLAGS: -lgdal
import "C"
@monkeybutter
monkeybutter / aeromettree_extract
Created February 5, 2017 01:32
AeroMetTree Extractor
#!/usr/bin/python
import urllib.request
import sys, getopt
from datetime import datetime, timedelta
import math
import numpy as np
import re
regex = re.compile('stationName\[\d{4,5}\]\n')
package main
// export PROJ_LIB=$GOPATH/src/github.com/xeonx/proj4/share/
import (
"fmt"
"github.com/xeonx/geom"
"github.com/xeonx/proj4"
"image"
"image/color/palette"
package main
import (
"fmt"
"math"
)
func toWGS84(xLon, yLat float64) (lon, lat float64) {
// Check if coordinate out of range for Web Mercator
#include "gdal.h"
#include "ogr_core.h"
#include "ogr_srs_api.h"
#include "cpl_conv.h"
#include <assert.h>
char *WGS84WKT = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]";
int
main()
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.