Skip to content

Commit

Permalink
use chunksizes to ensure a dict
Browse files Browse the repository at this point in the history
  • Loading branch information
aulemahal committed Nov 29, 2023
1 parent fbf3ae9 commit 4b6c1cd
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions xclim/indices/_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,9 @@ def potential_evapotranspiration(
tasmin = convert_units_to(tasmin, "degF")
tasmax = convert_units_to(tasmax, "degF")

re = extraterrestrial_solar_radiation(tasmin.time, lat, chunks=tasmin.chunks)
re = extraterrestrial_solar_radiation(
tasmin.time, lat, chunks=tasmin.chunksizes
)
re = convert_units_to(re, "cal cm-2 day-1")

# Baier et Robertson(1965) formula
Expand All @@ -1397,7 +1399,9 @@ def potential_evapotranspiration(

lv = 2.5 # MJ/kg

ra = extraterrestrial_solar_radiation(tasmin.time, lat, chunks=tasmin.chunks)
ra = extraterrestrial_solar_radiation(
tasmin.time, lat, chunks=tasmin.chunksizes
)
ra = convert_units_to(ra, "MJ m-2 d-1")

# Hargreaves and Samani (1985) formula
Expand All @@ -1415,7 +1419,7 @@ def potential_evapotranspiration(
tasK = convert_units_to(tas, "K")

ext_rad = extraterrestrial_solar_radiation(
tas.time, lat, solar_constant="1367 W m-2", chunks=tas.chunks
tas.time, lat, solar_constant="1367 W m-2", chunks=tas.chunksizes
)
latentH = 4185.5 * (751.78 - 0.5655 * tasK)
radDIVlat = ext_rad / latentH
Expand Down Expand Up @@ -1972,7 +1976,13 @@ def mean_radiant_temperature(

if stat == "sunlit":
csza = cosine_of_solar_zenith_angle(
dates, dec, lat, lon=lon, stat="average", sunlit=True, chunks=rsds.chunks
dates,
dec,
lat,
lon=lon,
stat="average",
sunlit=True,
chunks=rsds.chunksizes,
)
elif stat == "instant":
tc = time_correction_for_solar_angle(dates)
Expand All @@ -1983,7 +1993,7 @@ def mean_radiant_temperature(
lon=lon,
time_correction=tc,
stat="instant",
chunks=rsds.chunks,
chunks=rsds.chunksizes,
)
else:
raise NotImplementedError(
Expand Down

0 comments on commit 4b6c1cd

Please sign in to comment.