This file contains 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 closest(val, vallist, index=True): | |
""" returns the closest value or index to a date in a list | |
=========== ====================== | |
keyword description | |
----------- ---------------------- | |
index [True] returns index | |
=========== ====================== | |
""" |
This file contains 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
In [62]: empty = xr.DataArray(zed, dims=['ageclass', 'pointspec', 'time', 'latitude', 'longitude'], coords={'time':taxis, 'latitude': dset.l | |
...: atitude, 'longitude':dset.longitude}) | |
In [63]: empty | |
Out[63]: | |
<xarray.DataArray (ageclass: 1, pointspec: 1, time: 2557, latitude: 360, longitude: 720)> | |
array([[[[[ 0., ..., 0.], | |
..., | |
[ 0., ..., 0.]], |
This file contains 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
Starting Load Kernel Modules... | |
Starting Load/Save RF Kill Switch Status... | |
[[0;1;31mFAILED[0m] Failed to start Load Kernel Modules. | |
See 'systemctl status systemd-modules-load.service' for details. | |
[[0;32m OK [0m] Started File System Check Daemon to report status. | |
Starting Load Kernel Modules... | |
[[0;1;31mFAILED[0m] Failed to start Load Kernel Modules. | |
See 'systemctl status systemd-modules-load.service' for details. | |
[[0;32m OK [0m] Reached target Sound Card. | |
Starting Load Kernel Modules... |
This file contains 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
Trying to merge / combine to xray.Datasets: | |
In [161]: o1 = xray.Dataset({'x':(('t'), (np.ones(10)))}, coords={'t':np.arange(10)}) | |
In [162]: o2 = xray.Dataset({'x':(('t'), (np.ones(10) * 2))}, coords={'t':np.arange(5,15)}) | |
In [163]: o1 | |
Out[163]: | |
<xray.Dataset> | |
Dimensions: (t: 10) |
This file contains 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
In [15]: em1 | |
Out[15]: | |
<xray.Dataset> | |
Dimensions: (lat: 720, lon: 1440, time: 4) | |
Coordinates: | |
* lat (lat) float32 89.875 89.625 89.375 89.125 88.875 88.625 ... | |
* lon (lon) float32 -179.875 -179.625 -179.375 -179.125 -178.875 ... | |
* time (time) datetime64[ns] 2004-08-01 2004-08-02 2004-08-03 2004-08-04 | |
Data variables: | |
emissions (time, lat, lon) float64 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... |
This file contains 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
class Structure(dict, object): | |
""" A ditionary that acts like a matlab structure. | |
""" | |
def __getattr__(self, attr): | |
# Fake a __getstate__ method that returns None | |
if attr == "__getstate__": | |
return lambda: None | |
try: |
This file contains 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
#!/usr/bin/env python | |
""" | |
jfb, 2010.10.20 | |
""" | |
from copy import copy | |
import shutil | |
import datetime as dt |
This file contains 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
""" | |
Series of data are loaded from a .csv file, and their names are | |
displayed in a checkable list view. The user can select the series | |
it wants from the list and plot them on a matplotlib canvas. | |
Use the sample .csv file that comes with the script for an example | |
of data series. | |
Eli Bendersky ([email protected]) | |
License: this code is in the public domain |
This file contains 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 remove_dups(x, y, z): | |
""" | |
## for regridding need to remove any duplicates | |
## First make sure there is enough data | |
""" | |
if len(z) > 10: | |
vals = zip(x, y, z) | |
vals.sort() | |
z0 = zip(x, y) |