Skip to content

Instantly share code, notes, and snippets.

View RichardScottOZ's full-sized avatar

RichardScottOZ

  • Australia
View GitHub Profile
@rsignell-usgs
rsignell-usgs / csw_plots.ipynb
Created June 4, 2013 14:11
CSW access with plots
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@edsu
edsu / wpd2txt.py
Last active July 24, 2022 06:19
convert a wordperfect file to messy text
#!/usr/bin/env python
import sys
"""
For each character c, if its value is:
#13: treat as newline
#128, #160: treat as space ' '
#169..#171, #173, #174: treat as dash '-'
#192..#236: skip ahead and ignore all characters until another occurrence
@chrisRedwine
chrisRedwine / pip_install
Created July 20, 2016 18:00
Pip install a specific github repo tag or branch
# From https://coderwall.com/p/-wbo5q/pip-install-a-specific-github-repo-tag-or-branch
pip install -e git://github.com/{ username }/{ reponame }.git@{ tag name }#egg={ desired egg name }
@wgurecky
wgurecky / par_dask_griddata.py
Last active October 24, 2023 21:22
Parallel scipy griddata with Dask
#!/usr/bin/python3
#!/usr/bin/env python
#-*- coding: utf-8 -*-
#==============================================================================
# Copyright (c) 2018, William Gurecky
# All rights reserved.
#
# DESCRIPTION:
# Inspired from stack overflow question:
# https://stackoverflow.com/questions/52227599/interpolate-griddata-uses-only-one-core
@parente
parente / README.md
Last active March 7, 2023 11:50
Jupyter Tidbit: IPython's ! returns an SList

Summary

IPython shell assignment (the ! operator) evaluates a command using the local shell (e.g., bash) and returns a string list (IPython.utils.text.SList). An SList is a list-like object containing "chunks" of stdout and stderr, properties for accessing those chunks in different forms, and convenience methods for operating on them.

Example

Binder

The SList.ipynb notebook below uses SList properties to access the output of a shell command as a list-like of strings, a newline-separated string, a space-separated string, and a list of pathlib.Path objects. The notebook then uses the SList.fields() and SList.grep() methods to extract columns from and search command output.

@jakelevi1996
jakelevi1996 / Running TensorFlow Sessions inside sub-processes.md
Last active July 4, 2022 19:13
Running TensorFlow Sessions inside sub-processes

Running TensorFlow Sessions inside sub-processes

In some applications of machine learning/TensorFlow, it is desirable to start multiple processes, and have separate training procedures running concurrently in each of those processes. A useful Python method for achieving this is the multiprocessing.pool.Pool.map() method (or the equivalent starmap() method when the target function takes multiple arguments; see the section "Process Pools" from the description of the multiprocessing module in the Python Library Reference).

The Pool.map() method takes a target-function and a list (or more generally an iterable) of arguments, and returns an equivalent iterable of the results of the function evaluated on each member of the argument-list (which is similar to the [built-in Python function map()

@jacobtomlinson
jacobtomlinson / Dask on Fargate from scratch.ipynb
Last active February 17, 2025 03:48
Dask on Fargate from scratch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jesserobertson
jesserobertson / grd_to_tif.py
Last active March 12, 2025 06:43
Convert all Geosoft *.grd files to geotiff in a directory (recursively)
import pathlib
from itertools import product
from tqdm import tqdm
import rasterio
import geosoft
import geosoft.gxpy.gx as gx
import geosoft.gxpy.coordinate_system as gxcs
import geosoft.gxpy.grid as gxgrid
@andrewdhicks
andrewdhicks / dask-median.ipynb
Created March 13, 2019 23:04
median() for a dask-backed xarray
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.