Skip to content

Instantly share code, notes, and snippets.

View herbiebradley's full-sized avatar
🚀

Herbie Bradley herbiebradley

🚀
View GitHub Profile
import argparse
import urllib.request
from pprint import pprint
from unidiff import PatchSet
def process_ind_patch(patch_diff) -> dict:
"""Process patch to get diff data."""
patch_parsed_diff: dict = {
@herbiebradley
herbiebradley / vscode_ukca.md
Created March 31, 2022 21:57
Connecting to the UKCA VMs using VS Code

Connecting to the UKCA VMs using VS Code

Introduction and Basic Setup

Visual Studio Code offers an alternative way to connect to a cloud VM, via its built-in Remote Development pack. This allows you to use the full features of the code editor in the virtual machine while running the editor on your own computer. This works by installing a VS Code server on the VM which communicates all necessary information back to the VS Code running on your own machine. Once setup, you can edit and run code, run a debugger, or open a terminal in VS Code on the virtual machine in the same way that you would for non-remote development.

To set up, you need to define an SSH config file with the IP address of your VM and path to your private key file as described in the UKCA Tutorial Configuration Page. Not

@herbiebradley
herbiebradley / subgrid_deep_learning.md
Created July 5, 2020 18:37
Notes for the paper "Deep learning to represent subgrid processes in climate models"

Deep learning to represent subgrid processes in climate models

Background

  • GCMs (General Circulation Models) are the basis for simulations of the future climate, but due to computational cost they are unable to run high resolution global models. Typically GCMs are limited to 50-100km horizontal grid resolution, but many important climate processes like clouds, occur at much smaller resolutions.
  • Subgrid processes are represented with parameterisations - scalar values representing important properties of clouds, such as the fraction of cloud cover within each GCM grid cell.
  • A popular approach to estimating these parameters is to use Cloud Resolving Models (CRMs). These are high resolution models that simulate clouds at scales of 100m up to 4 km. CRMs can be inserted into each grid column of a GCM to effectively resolve small scale features 3-4 orders of magnitude more efficiently than the GCM at high resolution.
@herbiebradley
herbiebradley / prime_search.py
Last active December 12, 2018 21:47
Python module for turning a piece of rectangular number art into a prime number version.
"""This module loads a piece of rectangular number art and generates a prime number version.
Requires:
- Python 2.7 or 3+
- gmpy2
The code slides a filter window of size 3 across the number art from the start_ind to the
end_ind, checking each possible 3 digit combination for primality with the Miller-Rabin
probabalistic primality test.