Skip to content

Instantly share code, notes, and snippets.

Avatar

Jody Klymak jklymak

View GitHub Profile
@jklymak
jklymak / Chaining Runs.md
Created Sep 24, 2021
Chaining MITgcm model runs
View Chaining Runs.md
#!/bin/bash -l
for todo in OneHill100lowU10N10Amp305f141B059Rough
do
    day=86400
    jobid=$(sbatch -J $todo --export=start=0,stop=$((day*6 + 180)),dt=90 runModel.sh)
    #echo $jobid
    jobid1=$(sbatch  -J $todo  --dependency=afterok:${jobid##* } --export=start=$((day*6)),stop=$((day*12 + 180)),dt=90 runModel.sh)
    jobid2=$(sbatch  -J $todo --dependency=afterok:${jobid1##* } --export=start=$((day*12)),stop=$((day*18 + 180)),dt=90 runModel.sh)
    jobid3=$(sbatch  -J $todo --dependency=afterok:${jobid2##* } --export=start=$((day*18)),stop=$((day*24 + 180)),dt=90 runModel.sh)
View Create_git.md

#MITgcm checkin runs

Sometimes we want to store versions of config files for a model run. This uses runname to make a new branch, and to make a commit on the main branch. You need to set the model config up to be tracked, of course.

_log.info('doing this via git!!')
@jklymak
jklymak / getstatus_slurm.py
Created Mar 12, 2021
getting status from MITGCM on slurm
View getstatus_slurm.py
import sys
import os
import subprocess
os.system('sq')
out=subprocess.check_output('squeue -h -t RUNNING -u jklymak --Format="Name:50"',
shell=True, text=True)
out = out.splitlines()
# print(out)
for dd in out:
View MITgcm_chaining.md

Chaining multiple MITgcm jobs

These were done for AbHillInter, on the machine koehr.

runAll.sh

#!/bin/sh -l
todo=Iso1kmlowU10Amp305f141B059Wall

one=$(qsub -N $todo -v "start=0, stop=259300, dt=50" runModelRestarts.sh)
two=$(qsub -N $todo -v "start=259200, stop=518500, dt=50"  -W depend=afterok:$one runModelRestarts.sh)
View distance_along_line.py
def get_xy(ds, lat0, lon0):
x = (ds.longitude - lon0) * np.cos(np.deg2rad(lat0)) * 60 * 1.852
y = (ds.latitude - lat0) * 60 * 1.852
ds['x'] = x
ds.x.attrs['units'] = f'km east of {lon0}'
ds['y'] = y
ds.y.attrs['units'] = f'km north of {lat0}'
return ds
def dist(x1,y1, x2,y2, x3,y3): # x3,y3 is the point
View outputdviasm
[preamble]
id: 2
numerator: 25400000
denominator: 473628672
magnification: 1000
comment: ' TeX output 2020.06.30:2115'
[postamble]
maxv: 5088.900009pt
maxh: 5058.900009pt
@jklymak
jklymak / TimeSeriesNotes.ipynb
Last active Sep 17, 2021
TimeSeriesNotes.ipynb
View TimeSeriesNotes.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View GetBottomDrag.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View BottomDrag.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jklymak
jklymak / tcalc.ipynb
Created Mar 17, 2019
Temp budget calc
View tcalc.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.