Skip to content

Instantly share code, notes, and snippets.

@cuulee
cuulee / convert.py
Created September 8, 2022 13:50 — forked from kylebarron/convert.py
preprocessing script for geoparquet on the web demo (https://observablehq.com/@kylebarron/geoparquet-on-the-web)
import geopandas as gpd
import pandas as pd
import pyarrow as pa
import pyarrow.feather as feather
import pyarrow.parquet as pq
import pygeos
import pyogrio
# https://ookla-open-data.s3.us-west-2.amazonaws.com/parquet/performance/type=mobile/year=2019/quarter=1/2019-01-01_performance_mobile_tiles.parquet
@cuulee
cuulee / smooth2d.R
Created August 9, 2022 00:59 — forked from eliocamp/smooth2d.R
Smooths a 2D field using Discrete Cosine Transform
#' Smooths a 2D field by truncating the Discrete Cosine Transform components
#'
#' @param x,y Vector of x and y coordinates
#' @param value Vector of values
#' @param kx,ky Proportion of components to keep in the x and
#' y direction respectively. Lower values increased the smoothness.
#'
#' @examples
#' library(ggplot2)
#' Creates a noisy version of the volcano dataset and applies the smooth
@cuulee
cuulee / xgboost_to_solr.py
Created June 23, 2022 07:33 — forked from ilivans/xgboost_to_solr.py
Convert XGBoost model into Solr LTR MultipleAdditiveTreesModel
import json
from xgboost import XGBModel
def dump_xgbmodel(xgb_model: XGBModel) -> dict:
"""
Dump XGBModel instance as a Solr LTR MultipleAdditiveTreesModel model.
Solr LTR MART model specification:
@cuulee
cuulee / advanced_rasterio_features.ipynb
Created June 21, 2022 13:48 — forked from sgillies/advanced_rasterio_features.ipynb
Advanced Rasterio features notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cuulee
cuulee / mapnik_render_static_map.py
Created May 25, 2022 11:41 — forked from andrewharvey/mapnik_render_static_map.py
Render a static map using Mapnik given centre, zoom and image width/height.
#!/usr/bin/env python
# This script is like generate_image.py from the OSM Mapnik code,
# but it renders based on a given centre point, zoom and final image pixel size
# Author: Andrew Harvey <[email protected]>
# License: CC0 http://creativecommons.org/publicdomain/zero/1.0/
#
# To the extent possible under law, the person who associated CC0
# with this work has waived all copyright and related or neighboring
@cuulee
cuulee / README.md
Created January 9, 2022 23:57 — forked from jsanz/README.md
Analysis example: Voronoi on CartoDB

This example loads a CartoDB layer using a crazy SQL from a small variation of this awesome Stack Overflow response. Note the use of CSS style tags for the CartoCSS to allow easy editing.

The uncompressed (and not perfect!) version of the SQL to draw the Voronoi diagram is:

WITH 
    Sample AS (
      SELECT st_setsrid(st_union(the_geom),0) as geom 
      FROM registro_centros_nz WHERE spanish = 1
    ),
@cuulee
cuulee / STAC Leafmap time series
Created September 28, 2021 01:48 — forked from darrenwiens/STAC Leafmap time series
Make a Leafmap time series animation from STAC query results
import ipyleaflet
import json
import requests
stac_api = "https://earth-search.aws.element84.com/v0"
search_endpoint = f"{stac_api}/search"
collection = "sentinel-s2-l2a-cogs"
payload = {
"bbox": [
@cuulee
cuulee / unet_inria_colabx.ipynb
Created September 19, 2021 17:18
unet_inria_colabx.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cuulee
cuulee / ee_pdsi_explorer_conus.md
Created July 2, 2021 05:03 — forked from jdbcode/ee_pdsi_explorer_conus.md
An Earth Engine App script that displays a PDSI map and time series chart for CONUS

Earth Engine App
Earth Engine Code Editor script

/**
 * @license
 * Copyright 2021 The Google Earth Engine Community Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@cuulee
cuulee / s1multitempclass.ipynb
Created June 19, 2021 13:51 — forked from mortcanty/s1multitempclass.ipynb
S1MultitempClass.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.