Skip to content

Instantly share code, notes, and snippets.

View RichardScottOZ's full-sized avatar

RichardScottOZ

  • Australia
View GitHub Profile
@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
@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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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.


@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):
@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.
@abelcallejo
abelcallejo / README.md
Last active April 8, 2025 22:39
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:

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ramdesh
ramdesh / keras_model_s3_wrapper.py
Created December 8, 2020 21:56
Save and load Keras models to and from AWS S3
import s3fs
import zipfile
import tempfile
import numpy as np
from tensorflow import keras
from pathlib import Path
import logging
AWS_ACCESS_KEY="aws_access_key"
@pmbaumgartner
pmbaumgartner / conda-pack-win.md
Last active January 7, 2025 13:54
Conda-Pack Windows Instructions

Packing Conda Environments

You must be using conda for this approach. You will need conda installed on the Source machine and the Target machine. The Source machine must have an internet connection, the Target does not. The OS in both environments must match; no going from macOS to Win10 for example.

1. (Source) Install conda-pack in your base python environment.

conda install -c conda-forge conda-pack