Skip to content

Instantly share code, notes, and snippets.

View cheginit's full-sized avatar
🍕

Taher Chegini cheginit

🍕
View GitHub Profile
@cheginit
cheginit / vd.py
Created October 3, 2023 23:46
Plot an example for Voroni Diagram
import shapely
import matplotlib.pyplot as plt
line = shapely.LineString([(0, 0), (2, 2), (5, 3), (6, 4), (9, 5), (12, 5), (15, 6)])
poly = line.buffer(2.5)
fig, ax = plt.subplots(figsize=(6, 6), dpi=300)
gpd.GeoSeries(list(shapely.voronoi_polygons(poly).geoms)).plot(ax=ax, fc="none", ec="k", lw=0.5)
gpd.GeoSeries([poly]).plot(ax=ax, fc="none", ec="r", lw=2)
ax.set_axis_off()
01013500,01022500,01030500,01031500,01047000,01052500,01054200,01055000,01057000,01073000,01078000,01117468,01118300,01121000,01123000,01134500,01137500,01139000,01139800,01142500,01144000,01150900,01162500,01169000,01170100,01181000,01187300,01195100,01208990,01333000,01350000,01350080,01350140,01362200,01365000,01411300,01413500,01414500,01415000,01423000,01434025,01435000,01439500,01440000,01440400,01451800,01466500,01484100,01485500,01486000,01487000,01491000,01510000,01516500,01518862,01532000,01539000,01542810,01543000,01543500,01544500,01545600,01547700,01548500,01549500,01550000,01552000,01552500,01557500,01564500,01567500,01568000,01580000,01583500,01586610,01591400,01594950,01596500,01605500,01606500,01613050,01620500,01632000,01632900,01634500,01638480,01639500,01644000,01658500,01664000,01666500,01667500,01669000,01669520,02011400,02011460,02013000,02014000,02015700,02016000,02017500,02018000,02027000,02027500,02028500,02038850,02046000,02051000,02051500,02053200,02053800,02055100,02056900,0205950
@cheginit
cheginit / conus_station_ids.csv
Last active February 22, 2023 16:48
Conus station IDs with their associated NHD ComID and total drainage area
We can't make this file beautiful and searchable because it's too large.
site_no,nhd_id,nhd_areasqkm
01206900,7712706,258.482
01206000,7713630,183.89
01105917,5878903,62.16
01205500,7718288,3998.96
01109200,6129557,11.2665
01196580,6177870,46.62
01202501,7713634,98.679
01103390,5867515,33.67
01127500,6168318,231.287
@cheginit
cheginit / nhd_fcode.json
Last active June 30, 2021 20:06
NHD FCodes
{"Feature Type":{"55800":"ARTIFICIAL PATH","33600":"CANAL\\/DITCH","33601":"CANAL\\/DITCH","33603":"CANAL\\/DITCH","56600":"COASTLINE","33400":"CONNECTOR","42800":"PIPELINE","42801":"PIPELINE","42802":"PIPELINE","42803":"PIPELINE","42804":"PIPELINE","42805":"PIPELINE","42806":"PIPELINE","42807":"PIPELINE","42808":"PIPELINE","42809":"PIPELINE","42810":"PIPELINE","42811":"PIPELINE","42812":"PIPELINE","42813":"PIPELINE","42814":"PIPELINE","42815":"PIPELINE","42816":"PIPELINE","46000":"STREAM\\/RIVER","46003":"STREAM\\/RIVER","46006":"STREAM\\/RIVER","46007":"STREAM\\/RIVER","42000":"UNDERGROUND CONDUIT","42001":"UNDERGROUND CONDUIT","42002":"UNDERGROUND CONDUIT","42003":"UNDERGROUND CONDUIT","49300":"ESTUARY","37800":"ICE MASS","39000":"LAKE\\/POND","39001":"LAKE\\/POND","39004":"LAKE\\/POND","39005":"LAKE\\/POND","39006":"LAKE\\/POND","39009":"LAKE\\/POND","39010":"LAKE\\/POND","39011":"LAKE\\/POND","39012":"LAKE\\/POND","36100":"PLAYA","43600":"RESERVOIR","43601":"RESERVOIR","43603":"RESERVOIR","43604":"RESERV
{"description":{"DAM_NAME":"The official name of the dam. No abbreviations unless the abbreviation is a part of the official name. For dams that do not have an official name, the popular name is used.","OTHER_DAM_NAME":"Names other than the official name (i.e., reservoir name) of the dam in common use. Names are separated using a semi-colon. Blank if not applicable.","DAM_FORMER_NAME":"Previous reservoir or dam name(s), if changed. Names are separated using a semi-colon.","NIDID":"The official NID identification number for the dam, known formerly as the National ID. This is a required field, and must have an entry for each dam included in the NID. This field is used as the unique identifier for each dam record. The first two characters of the identity are the state two-letter abbreviation, based on the location of the dam. Typically, the last five characters of the identity are a unique number (AB#####); although States are allowed to use alphanumeric combinations in these last five characters.For saddle dams
#!/bin/bash
set -Eeuox pipefail
usage() {
echo "Usage: $0 [OPTIONS]" 1>&2
echo "Options:" 1>&2
echo " -g : Flag for setting up github ssh." 1>&2
echo " -c <path> : Path to a directory for cloning github repositories" 1>&2
echo " The default is ~/repos/github" 1>&2
echo " -b <path> : Path to a directory for installing applications" 1>&2
@cheginit
cheginit / texlive.profile
Created February 15, 2020 01:35
custom texlive installation profile to use with sudo ./install-tl -profile
# texlive.profile written on Sat Feb 15 01:13:54 2020 UTC
# It will NOT be updated and reflects only the
# installation profile at installation time.
selected_scheme scheme-custom
TEXDIR /usr/local/texlive/2019
TEXMFCONFIG ~/.texlive2019/texmf-config
TEXMFHOME ~/texmf
TEXMFLOCAL /usr/local/texlive/texmf-local
TEXMFSYSCONFIG /usr/local/texlive/2019/texmf-config
TEXMFSYSVAR /usr/local/texlive/2019/texmf-var
#!/bin/bash
set -Eeuox pipefail
usage() {
echo "Usage: $0 [OPTIONS]" 1>&2
echo "Options:" 1>&2
echo " -u <string> : Github username for setting github configuration" 1>&2
echo " -t <string> : Github token for setting github configuration" 1>&2
echo " -e <string> : Github email for setting github configuration" 1>&2
echo " -g <path> : Path to a directory for cloning github repositories" 1>&2
@cheginit
cheginit / fresh_install.sh
Last active November 13, 2019 12:27
Fresh Regolith install
#!/bin/bash
set -e
# ===================== USER CONFIGURATION ===================== #
# location where github repositories of the apps will be downloaded to
export GITHUB_DIR="$HOME/repos/github"
# Whether install GIS related packages such netcdf and paraview
GIS=true
if [[ $GIS == 'true' ]]; then