Skip to content

Commit

Permalink
Merge pull request #212 from monocongo/issue_210_map_parallelization
Browse files Browse the repository at this point in the history
Updated parallelization approach now working for SPI and PET
  • Loading branch information
monocongo authored Nov 16, 2018
2 parents f6c4428 + 517110f commit 9b3edde
Show file tree
Hide file tree
Showing 2 changed files with 463 additions and 214 deletions.
8 changes: 5 additions & 3 deletions climate_indices/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,12 @@ def pet(temperature_celsius, latitude_degrees, data_start_year):
# we started with all NaNs for the temperature, so just return the same
return temperature_celsius

# if we've been passed an array of latitude values then just use
# the first one (useful when applying this function with xarray.GroupBy)
# If we've been passed an array of latitude values then just use
# the first one -- useful when applying this function with xarray.GroupBy
# or numpy.apply_along_axis() where we've had to duplicate values in a 3-D
# array of latitudes in order to correspond with a 3-D array of temperatures.
if isinstance(latitude_degrees, np.ndarray) and (latitude_degrees.size > 1):
latitude_degrees = latitude_degrees[0]
latitude_degrees = latitude_degrees.flat[0]

# make sure we're not dealing with a NaN or out-of-range latitude value
if (
Expand Down
Loading

0 comments on commit 9b3edde

Please sign in to comment.