Skip to content

Commit 91a52dc

Browse files
Add encode_cf_datetime benchmark (#9262)
1 parent 07307b4 commit 91a52dc

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

asv_bench/benchmarks/coding.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import numpy as np
2+
3+
import xarray as xr
4+
5+
from . import parameterized
6+
7+
8+
@parameterized(["calendar"], [("standard", "noleap")])
9+
class EncodeCFDatetime:
10+
def setup(self, calendar):
11+
self.units = "days since 2000-01-01"
12+
self.dtype = np.dtype("int64")
13+
self.times = xr.date_range(
14+
"2000", freq="D", periods=10000, calendar=calendar
15+
).values
16+
17+
def time_encode_cf_datetime(self, calendar):
18+
xr.coding.times.encode_cf_datetime(self.times, self.units, calendar, self.dtype)

0 commit comments

Comments
 (0)