Skip to content

Instantly share code, notes, and snippets.

View RichardScottOZ's full-sized avatar

RichardScottOZ

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@abelcallejo
abelcallejo / README.md
Last active May 27, 2025 21:46
Installing GDAL 3.2.1 on Amazon Linux 2

Installing GDAL 3.2.1 on Amazon Linux 2

gdal linux yum

As of this day, this is probably the only and fastest way of installing it.

Package requirements

Based from the GDAL and PROJ build requirements, here is the full list of required packages to install:

@rmg55
rmg55 / Warp_Xarray.ipynb
Last active July 26, 2022 10:21
Wrapping Raster to Xarray+Dask
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chmodsss
chmodsss / fine_tune_glove.py
Created April 19, 2020 06:26
Fine tuning glove embeddings using Mittens
import csv
import numpy as np
from collections import Counter
from nltk.corpus import brown
from mittens import GloVe, Mittens
from sklearn.feature_extraction import stop_words
from sklearn.feature_extraction.text import CountVectorizer
def glove2dict(glove_filename):
@ElefHead
ElefHead / Installing_theano_and_pymc3.md
Last active January 16, 2025 21:03
A guide to install pymc3, theano with CUDA on windows 10 -- Dec 2019

I am writing this gist because I spent 6 hours navigating links trying to get Theano to work with CUDA on windows 10. Hopefully, you wouldn't have to. Once theano is setup and running, you can install pymc3 and it all works. I had tensorflow-gpu setup and running on windows 10; it isn't as simple as pip install theano.

I will list down the instructions, with the links where I found them. Hope this helps someone.

This set of instructions depend on anaconda. Also, this is sort of hacky in the end.

Ok let's begin.


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kwinkunks
kwinkunks / README.md
Last active March 16, 2022 08:40
Rip data from a pseudocolour image, given the colourmap

Ripping data from pseudocolour images

Because viridis, like all good colourmaps, is perceptually linear, it's easy to get the data from it: just use a greyscale version of the image. But you can rip the data from any pseudocolour image if you know (or can guess) the colourmap.

In the rip-data.py example, here's the approach:

  1. Read the image and transform the values to the range 0-1.
  2. Guess the colourmap, in this case it's viridis. Matplotlib conveniently gives us the RGB triples that make up a colourmap.
@prakharcode
prakharcode / resample.py
Last active September 1, 2021 04:42
Resample, reprojection and stacking of bands using rasterio
band_dict = {
""" dictonary containing all the bands that are to be stacked
in the following format:
band_index : "path/to/band"
"""
}
dst_projection = 'EPSG:4326' # the final projection
ref_band = "path/to/ref_band/" # the band that you want as a reference
@andrewdhicks
andrewdhicks / dask-median.ipynb
Created March 13, 2019 23:04
median() for a dask-backed xarray
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jesserobertson
jesserobertson / grd_to_tif.py
Last active December 30, 2025 16:27
Convert all Geosoft *.grd files to geotiff in a directory (recursively)
import pathlib
from itertools import product
from tqdm import tqdm
import rasterio
import geosoft
import geosoft.gxpy.gx as gx
import geosoft.gxpy.coordinate_system as gxcs
import geosoft.gxpy.grid as gxgrid