Skip to content

Instantly share code, notes, and snippets.

View MiCurry's full-sized avatar

Miles Curry MiCurry

View GitHub Profile
@MiCurry
MiCurry / mpas_init_atm_core.F
Last active January 29, 2020 18:35
MPAS Init Atm Core with tests for mpas_stack.F
! Copyright (c) 2013, Los Alamos National Security, LLC (LANS)
! and the University Corporation for Atmospheric Research (UCAR).
!
! Unless noted otherwise source code is licensed under the BSD license.
! Additional copyright and license information can be found in the LICENSE file
! distributed with this code, or at http://mpas-dev.github.com/license.html
!
module init_atm_core
use mpas_stack
@MiCurry
MiCurry / sphere_distance.py
Created October 10, 2019 20:21
Function to calculate a sphere distance
def sphere_distance(lat1, lon1, lat2, lon2, radius, **kwargs):
""" Calculate the sphere distance between point1 and point2.
lat1 - Float - Radians - -pi:pi
lon1 - Float - Radians - 0:2*pi
lat2 - Float - Radians - -pi:pi
lon2 - Float - Radians - 0:2*pi
radius - Radius of the earth (or sphere) - Units can be ignored
"""
from __future__ import absolute_import, division, print_function # Python 3 Support
import sys
from netCDF4 import Dataset
import numpy as np
if len(sys.argv) != 3: # Argument checking
print("Usage: python cellsOnCell.py meshFileName cell")
print("Please supply a mesh file and a cell number of your choosing")
sys.exit(-1)
@MiCurry
MiCurry / nearest_cell.py
Created July 24, 2019 16:00
MPAS Nearest Cell
from __future__ import absolute_import, division, print_function
import sys
import argparse
import numpy as np
from netCDF4 import Dataset
from mpas_py.mesh import MeshHandler
from mpas_py.soundings import read_soundings
@MiCurry
MiCurry / Python_Venv_Example.md
Last active February 25, 2019 21:28
Python Venv Examples

Python3 Venv Command Line Example

First, check to see where our current python installation is located:

> which python # And
> which python3
@MiCurry
MiCurry / download_hycom.py
Created December 31, 2018 18:48
Fancy NetCDF Python Example
# Just an example it wont outside of the application is was built in
# Uses Scipy.io netcdf and 'snetCDF 4 Dataset
from scipy.io import netcdf
from netCDF4 import Dataset
def navy_hycom_download(level='top'):
from pl_plot.plotter import HycomPlotter
print "NAVY HYCOM DOWNLOAD"
@MiCurry
MiCurry / ncepww3.py
Created April 22, 2018 18:14
ncep ww3 vs ucar ncep ww3
import matplotlib
matplotlib.use('AGG')
import os
import numpy
import xarray as xar
from matplotlib import pyplot as plt
from matplotlib import colors
@MiCurry
MiCurry / kombucha.py
Created March 18, 2018 22:20
kombucha batch calculator
# Calculates the ingridents for each part based on the number gallons
# for the total batch. 110% because I was lazy!
import argparse
parser = argparse.ArgumentParser(description="Easy way to cacluate how much\
'things you need per quanity of kombuhca")
parser.add_argument('-b', '--batch', type=float,
help='Float - Gallons of desired batch size')
@MiCurry
MiCurry / grammars
Created March 8, 2018 01:38
List of Simple Grammers
Goal -> ClockNoise
ClockNoise -> ClockNoise tick tock
| tick tock
@MiCurry
MiCurry / manage.py
Last active December 10, 2017 07:11
Update Manage.py
#!/usr/bin/env python
import os
import sys , traceback
import argparse
import time
import SharkEyesCore.startup as startup
from django.core.management import execute_from_command_line
from django.conf import settings