Skip to content

Instantly share code, notes, and snippets.

@bblay
bblay / time_contraints.py
Last active June 4, 2025 12:09
Iris time constraints, with and without bounds.
"""This example demonstrates a difference between a cell constraint and a point constraint."""
import iris
from iris.cube import Cube
from iris.coords import AuxCoord
# the required points arrive in a coord
wanted_points = AuxCoord([1, 2, 3])
# create the cube and constraints
import os
from itertools import product
from nbt.chunk import AnvilChunk
from nbt.world import AnvilWorldFolder
def main():
search_terms = ['netherite', 'allthemod']
import glob
import os
from argparse import ArgumentParser
import matplotlib.pyplot as plt
if __name__ == '__main__':
arg_parser = ArgumentParser(description='produce a line length histogram for a source folder')
arg_parser.add_argument('source')
from cartopy.crs import PlateCarree, TransverseMercator
plate_carree = PlateCarree()
trans_merc = TransverseMercator()
print trans_merc.transform_point(1, 55, src_crs=plate_carree)
@bblay
bblay / overtakes.py
Last active September 3, 2016 00:11
mins_per_day = 24 * 60
def identify_overtakes(num_hours):
num_mins = num_hours * 60
overtakes = []
last_diffs = [0.0, 0.0]
for i in xrange(num_mins):