Skip to content

Commit

Permalink
Add encode_cf_datetime benchmark (#9262)
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerkclark authored Jul 20, 2024
1 parent 07307b4 commit 91a52dc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions asv_bench/benchmarks/coding.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import numpy as np

import xarray as xr

from . import parameterized


@parameterized(["calendar"], [("standard", "noleap")])
class EncodeCFDatetime:
def setup(self, calendar):
self.units = "days since 2000-01-01"
self.dtype = np.dtype("int64")
self.times = xr.date_range(
"2000", freq="D", periods=10000, calendar=calendar
).values

def time_encode_cf_datetime(self, calendar):
xr.coding.times.encode_cf_datetime(self.times, self.units, calendar, self.dtype)

0 comments on commit 91a52dc

Please sign in to comment.