Skip to content

Instantly share code, notes, and snippets.

@crazyapril
crazyapril / track_errors.py
Last active June 4, 2020 16:39
along/cross track error calculation: for validation of storm track forecast
from dataclasses import dataclass
import numpy as np
from numpy import sin, cos
R = EARTH_RADIUS = 6371000
@dataclass
class Point:
@crazyapril
crazyapril / cyclone_symbol.py
Last active October 28, 2019 05:26
cyclone symbol for matplotlib (clockwise & anticlockwise, filled & hull)
"""Cyclone symbol. Includes anticlockwise (for northern hemisphere) and
clockwise (for southern hemisphere), filled and hull variants.
The path data is derived from 'weather-icons' repository on Github. Link:
https://github.com/erikflowers/weather-icons/blob/master/svg/wi-hurricane.svg
With slight modification, the path in this file is almost identical to the
icon in the SVG file.
"""
from matplotlib.path import Path
@crazyapril
crazyapril / bdeck.py
Created October 5, 2019 03:16
bdeck file reader (for BST files)
"""The BEST BDeck file reader I've seen yet. (lol)
Specifically designed for Best Track data, so it may be not that good in some
scenarios as BDeck format is used in many occasions. I would suggest you also
use wonderful `pandas` library to explore best track data in a very convenient
way!
See documentation for `BDeckFile` class to start.
"""