Skip to content

Instantly share code, notes, and snippets.

Avatar

Ali Ramadhan ali-ramadhan

  • Massachusetts Institute of Technology
  • Cambridge, MA, USA
View GitHub Profile
@ali-ramadhan
ali-ramadhan / eki_example.jl
Last active Dec 22, 2020
Ensemble Kalman inversion example by @sandreza using CalibrateEmulateSample.jl
View eki_example.jl
using Distributions
using LinearAlgebra
using Random
using Test
using Plots
using CalibrateEmulateSample.EKP
using CalibrateEmulateSample.ParameterDistributionStorage
## Seed for pseudo-random number generator
@ali-ramadhan
ali-ramadhan / getperts.F
Last active Dec 2, 2020
This code generates two-dimensional analytic perturbation fields. These perturbations can be used, for example, to initialize idealized numerical model simulations. The methodology is described in Bryan et al. (2007, JAS, p. 1249, section 4a); see also Knievel et al. (2007, MWR, 3808, section 2f). https://www2.mmm.ucar.edu/people/bryan/Code/getp…
View getperts.F
PROGRAM getperts
use singleton
implicit none
!-----------------------------------------------------------------------
!
! getperts: Version 1.04 Last modified: 12 October 2008
!
! Author: George H. Bryan
! Mesoscale and Microscale Meteorology Division
@ali-ramadhan
ali-ramadhan / dagger_plotting.jl
Created Oct 22, 2020
Parallel plotting in Julia with Dagger.jl
View dagger_plotting.jl
using Distributed
procs = Distributed.addprocs(16)
@everywhere begin
using Printf
using Dagger
using PyCall
using PyPlot
using NCDatasets
View plotting.jl
using Printf
using PyCall
using PyPlot
using NCDatasets
cmocean = pyimport("cmocean")
ioff() # Turn off interactive plotting
ds = NCDataset("dry_convection.nc")
View gist:d920ec50d0e40332121697f71b91eb36
Overhead ╎ [+additional indent] Count File:Line; Function
=========================================================
╎263 @Base/task.jl:358; (::REPL.var"#26#27"{REPL.REPLBackend})()
╎ 263 ...kage_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:118; macro expansion
╎ 263 ...kage_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86; eval_user_input(::Any, ::REPL.REPLBackend)
17╎ 263 @Base/boot.jl:331; eval(::Module, ::Any)
╎ 245 @Oceananigans/src/TimeSteppers/adams_bashforth.jl:41; time_step!(::IncompressibleModel{Oceananigans.TimeSteppers.AdamsBashforthTimeStepper{Float64,N...
╎ 8 @Oceananigans/src/TimeSteppers/adams_bashforth.jl:48; time_step!(::IncompressibleModel{Oceananigans.TimeSteppers.AdamsBashforthTimeStepper{Float64,N...
╎ ╎ 8 @Oceananigans/src/TimeSteppers/generic_time_stepping.jl:13; time_step_precomputations!(::Nothing, ::NamedTuple{(:pHY′, :pNHS),Tuple{OffsetArrays.OffsetAr...
╎ ╎ 8 @Oceananigans/src/BoundaryConditions
View eddying_channel_frame_makie.jl
using Makie, JLD2
file = jldopen("eddying_channel_375000.jld2")
T = file["T"]
close(file)
Tx, Ty, Tz = size(T) # Total number of grid points.
Nx, Ny, Nz = Tx-2, Ty-2, Tz # Number of interior grid points.
Hx, Hy, Hz = Tx-Nx, Ty-Ny, Tz-Nz # Size of halo regions.
Lx, Ly, Lz = 250, 500, 100 # Domain size: 250×500×1 km
View conda.jl_test_log_power9.txt
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.3.0 (2019-11-26)
_/ |\__'_|_|_|\__'_| |
|__/ |
julia> Sys.ARCH
View gist:6a36885905a3f245e7dedb418a867116
Building NCDatasets → `~/.julia/packages/NCDatasets/6tnso/deps/build.log`
┌ Error: Error building `NCDatasets`:
│ PREFIX=/home/alir/.julia/conda/3
│ Unpacking payload ...
│ /home/alir/.julia/conda/3/installer.sh: line 351: /home/alir/.julia/conda/3/conda.exe: cannot execute binary file
│ /home/alir/.julia/conda/3/installer.sh: line 353: /home/alir/.julia/conda/3/conda.exe: cannot execute binary file
│ [ Info: Downloading miniconda installer ...
│ [ Info: Installing miniconda ...
│ ERROR: LoadError: failed process: Process(`/home/alir/.julia/conda/3/installer.sh -b -f -p /home/alir/.julia/conda/3`, ProcessExited(1)) [1]
View gist:ec039bd71c21daff23c140b8aec180eb
ali-ramadhan@cyclops:~/Oceananigans.jl$ julia --project
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.1.0 (2019-01-21)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
View SchizophrenicRetribution.py
from random import random, choices
from Prisoner import Prisoner
"""
SchizophrenicRetribution: an old Prisoner who usually copies their
opponent's last choice, but forgets what to do as time goes on so
they usually just cooperate with anyone and everyone.
They won't stop telling you the same stories from their glory days