This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import matplotlib.ticker as mticker | |
| from matplotlib.patches import Rectangle | |
| # Replicate Figure 1.9 (page 10) in Wallace and Hobbs 2nd Edition | |
| # Standard atmosphere data (U.S. Standard Atmosphere 1976) | |
| # https://en.wikipedia.org/wiki/U.S._Standard_Atmosphere | |
| LEVELS_M = np.array([0, 11000, 20000, 32000, 47000, 51000, 71000, 84852, 90000, 120000]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # This script downloads and installs a specific version of VSCode Server for Linux. | |
| # The version is specified by the first argument to the script. | |
| # You can find the git commit id in the output of Remote - SSH plugin in VSCode. | |
| # The output looks like this: | |
| # ... | |
| # Using commit id "af28b32d7e553898b2a91af498b1fb666fdebe0c" and quality "stable" for server | |
| # ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from datetime import datetime | |
| import numpy as np | |
| def to_datetime(date): | |
| """ | |
| Converts a numpy datetime64 object to a python datetime object | |
| Input: | |
| date - a np.datetime64 object | |
| Output: | |
| DATE - a python datetime object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Brian Blaylock | |
| # Requres `s3fs` | |
| # Website: https://s3fs.readthedocs.io/en/latest/ | |
| # In Anaconda, download via conda-forge. | |
| import s3fs | |
| # Use the anonymous credentials to access public data | |
| fs = s3fs.S3FileSystem(anon=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #======================================================================= | |
| # Specify the "start" and "end" time. | |
| #======================================================================= | |
| # Use format "HH:MM YYYY-MM-DD" | |
| start="00:00 2021-04-01" | |
| end="00:00 2021-04-02" | |
| increment="+1 hours" | |
| #======================================================================= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import multiprocessing | |
| from multiprocessing.dummy import Pool as ThreadPool | |
| import numpy as np | |
| def my_multipro(items, func, max_cpus=12): | |
| """Do an embarrassingly parallel task using multiprocessing. | |
| Use this for CPU bound tasks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Brian Blaylock | |
| Most recent function is located here: | |
| https://github.com/blaylockbk/Carpenter_Workshop/blob/main/toolbox/gridded_data.py | |
| But you should consider using the nearest_points() function instead, found here: | |
| https://github.com/blaylockbk/Herbie/blob/master/herbie/tools.py | |
| ''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def border(array, corner=0, direction='cw'): | |
| """ | |
| Extract the values arround the border of a 2d array. | |
| Default settings start from top left corner and move clockwise. | |
| Corners are only used once. | |
| Parameters | |
| ---------- | |
| array : array_like |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import xarray as xr | |
| def to_180(lon): | |
| """ | |
| Wrap longitude from degrees [0, 360] to degrees [-180, 180]. | |
| An alternative method is | |
| lon[lon>180] -= 360 |
NewerOlder