Skip to content

Instantly share code, notes, and snippets.

View lucaswells's full-sized avatar

Lucas Wells lucaswells

View GitHub Profile
@lucaswells
lucaswells / divcd.py
Created January 9, 2024 02:57
Function to recode ECOSUBCD to DIVCD
def recode_divcd(df: pd.DataFrame) -> pd.DataFrame:
"""
Convert the ECOSUBCD column to DIVCD
Parameters
----------
df : pd.DataFrame
The input DataFrame
Returns
@lucaswells
lucaswells / gcs_dir_upload.sh
Last active April 21, 2021 16:06
Upload local directory to Google Cloud Storage bucket
#!/bin/bash
# ===================================================
# Upload Directory to GCP Cloud Storage
# ---------------------------------------------------
#
# ARGUMENTS
# =========
#
# GCP project id : string : pos 1
@lucaswells
lucaswells / raster2zarr.py
Last active June 24, 2023 03:04
Convert GeoTIFF to Zarr array
import matplotlib.pyplot as plt
import rasterio
from rasterio.windows import Window
import time
import zarr
def convert(raster_filepath, chunk_mbs=1):
"""
Converts raster file to chunked and compressed zarr array. Tested