Skip to content

Instantly share code, notes, and snippets.

Avatar

Jody Klymak jklymak

View GitHub Profile
@jklymak
jklymak / runMonitor.sh
Created Jun 15, 2022
Monitor script for cedar
View runMonitor.sh
#!/bin/bash
#SBATCH --account=def-jklymak
#SBATCH --mail-user=jklymak@gmail.com
#SBATCH --mail-type=ALL
#SBATCH --ntasks-per-node=1
#SBATCH --time=0-00:15
#SBATCH --mem=64G
cd ${SLURM_SUBMIT_DIR}
@jklymak
jklymak / distance_along_line.py
Last active Mar 30, 2022
Distance along a line
View distance_along_line.py
"""
Use https://github.com/jklymak/waypoint_distance instead!
"""
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
@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 / TimeSeriesNotes.ipynb
Last active Sep 17, 2021
TimeSeriesNotes.ipynb
View TimeSeriesNotes.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 outputdviasm
[preamble]
id: 2
numerator: 25400000
denominator: 473628672
magnification: 1000
comment: ' TeX output 2020.06.30:2115'
[postamble]
maxv: 5088.900009pt
maxh: 5058.900009pt
View GetBottomDrag.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View BottomDrag.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.