Skip to content

Instantly share code, notes, and snippets.

View OliverFishCode's full-sized avatar
🐟
Writing Fishy Code

Devon C. Oliver OliverFishCode

🐟
Writing Fishy Code
  • Minnesota Department of Natural Resources
  • Lake City, MN
View GitHub Profile
@soply
soply / disp_multiple_images.py
Last active November 22, 2024 04:48
Plot multiple images with matplotlib in a single figure. Titles can be given optionally as second argument.
import matplotlib.pyplot as plt
import numpy as np
def show_images(images, cols = 1, titles = None):
"""Display a list of images in a single figure with matplotlib.
Parameters
---------
images: List of np.arrays compatible with plt.imshow.
@d-wasserman
d-wasserman / FeatureTabletoDataframe.py
Last active October 18, 2024 20:23
Functions to convert a ArcGIS Table/Feature Class in arcpy to a pandas dataframe. For other options, check the new ArcGIS Python API, but this works across versions.
import arcpy
import pandas as pd
def arcgis_table_to_df(in_fc, input_fields=None, query=""):
"""Function will convert an arcgis table into a pandas dataframe with an object ID index, and the selected
input fields using an arcpy.da.SearchCursor.
:param - in_fc - input feature class or table to convert
:param - input_fields - fields to input to a da search cursor for retrieval
:param - query - sql query to grab appropriate values
:returns - pandas.DataFrame"""
@noamross
noamross / DRUG_code_LY.Rmd
Created December 3, 2012 19:52
Matrix population models by Lauren Yamane
A discrete time, age-structured model of a salmon population (semelparous) that can live to age 5, with fishing and environmental stochasticity (by Lauren Yamane, presented to UC Davis R Users' Group)
========================================================
Parameter values
```{r parameters, comment="#"}
a=60 #alpha for Beverton-Holt stock-recruitment curve
b=0.00017 #beta for Beverton-Holt
tf=2000 #number of time steps
N0=c(100,0,0,0,0) #initial population vector for 5 age classes
s=0.28 #survival rate with fishing