Skip to content

Commit

Permalink
Merge pull request #124 from AdamTheisen/master
Browse files Browse the repository at this point in the history
Fixes for new xarray version and more
  • Loading branch information
AdamTheisen authored Sep 20, 2019
2 parents fe8c0a1 + ca779d1 commit 574d8c1
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include AUTHORS.rst
include CONTRIBUTING.rst
include README.rst
include CREATING_ENVIRONMENTS.rst
Expand Down
7 changes: 4 additions & 3 deletions act/corrections/mpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ def correct_mpl(obj):
op_height = obj['overlap_correction_heights'].values[0, :]

# 1 - Remove negative height data
obj = obj.where(obj.height > 0, drop=True)
obj = obj.where(obj.height > 0., drop=True)
height = obj['height'].values

# The drop strips out the ACT data so re-populating
obj.act = act
# If act is not in object, add back in. Fixed in xarray v0.13.0
if hasattr(obj, 'act') is False:
obj.act = act

# Get indices for calculating background
var_names = ['signal_return_co_pol', 'signal_return_cross_pol']
Expand Down
4 changes: 2 additions & 2 deletions act/plotting/ContourDisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def create_contour(self, fields=None, time=None, function='cubic',
z.append(obj[field[2]].sel(time=time).values.tolist())

# Create a meshgrid for gridding onto
xs = np.arange(min(x) - grid_buffer, max(x) + grid_buffer, grid_delta[0])
ys = np.arange(min(y) - grid_buffer, max(y) + grid_buffer, grid_delta[1])
xs = np.arange(np.min(x) - grid_buffer, np.max(x) + grid_buffer, grid_delta[0])
ys = np.arange(np.min(y) - grid_buffer, np.max(y) + grid_buffer, grid_delta[1])
xi, yi = np.meshgrid(xs, ys)

# Use scipy radial basis function to interpolate data onto grid
Expand Down
10 changes: 5 additions & 5 deletions act/retrievals/stability_indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,19 @@ def calculate_stability_indicies(ds, temp_name="temperature",
where_500 = np.argmin(np.abs(p_sorted - 500 * units.hPa))
li = t_sorted[where_500] - t_profile[where_500]

ds["surface_based_cape"] = sbcape
ds["surface_based_cape"] = sbcape.magnitude
ds["surface_based_cape"].attrs['units'] = "J/kg"
ds["surface_based_cape"].attrs['long_name'] = "Surface-based CAPE"
ds["surface_based_cin"] = sbcin
ds["surface_based_cin"] = sbcin.magnitude
ds["surface_based_cin"].attrs['units'] = "J/kg"
ds["surface_based_cin"].attrs['long_name'] = "Surface-based CIN"
ds["most_unstable_cape"] = sbcape
ds["most_unstable_cape"] = sbcape.magnitude
ds["most_unstable_cape"].attrs['units'] = "J/kg"
ds["most_unstable_cape"].attrs['long_name'] = "Most unstable CAPE"
ds["most_unstable_cin"] = sbcin
ds["most_unstable_cin"] = sbcin.magnitude
ds["most_unstable_cin"].attrs['units'] = "J/kg"
ds["most_unstable_cin"].attrs['long_name'] = "Most unstable CIN"
ds["lifted_index"] = li
ds["lifted_index"] = li.magnitude
ds["lifted_index"].attrs['units'] = t_profile.units
ds["lifted_index"].attrs['long_name'] = "Lifted index"
ds["level_of_free_convection"] = lfc.magnitude
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ dependencies:
- distributed
- pandas
- pint
- pyproj>=2.0.0
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ distributed
pint
cartopy
boto3
pyproj
pyproj > '2.0.0'

0 comments on commit 574d8c1

Please sign in to comment.