Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import moviepy.editor as mpe
import sys
from pathlib import Path
fname = Path(sys.argv[1])
v = mpe.VideoFileClip(str(fname))
v.write_gif(fname.with_suffix(".gif"))
@dennissergeev
dennissergeev / Exoplanet-GCM-Output-Iris.ipynb
Last active November 12, 2025 14:49
Getting started with Unified Model output analysis using iris.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dennissergeev
dennissergeev / extract_by_time.py
Last active March 5, 2024 18:35
Extract by time in iris
"""Extract a cube slice using a time constraint."""
from datetime import datetime
import iris
# The cube with a time dimension
cube = mycubelist.extract_cube("some_variable")
# For example, we want to extract the time slice at 2020-04-29 12:00 model time,
# which corresponds to a time index of 123.
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
from matplotlib.offsetbox import AnchoredText
fig = plt.figure(figsize=(10, 10))
ax = fig.add_subplot(111, projection=ccrs.PlateCarree())
# Set extent of the map
@dennissergeev
dennissergeev / jlab_shortcuts.json
Last active November 14, 2022 19:50
Useful JupyterLab shortcuts
{
"shortcuts":[
{
"args": {},
"command": "notebook:restart-and-run-to-selected",
"keys": [
"Ctrl Q", "Ctrl Q"
],
"selector": ".jp-Notebook:focus"
},