Skip to content

Commit

Permalink
Fix error with daily 360 and noleap calendar data
Browse files Browse the repository at this point in the history
  • Loading branch information
noahprime committed Mar 25, 2024
1 parent c2133e4 commit cd3d107
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stitches/fx_stitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ def get_netcdf_values(i, dl, rp, fl, name):
# If using noleap calendar
if extracted['time'].dt.calendar == 'noleap':
# Get number of days over given period with no leap years
expected_len = xr.cftime_range(start = f'{start_yr}-01-01', end = f'{end_yr}-12-31', freq='D', calendar='noleap')
expected_len = len(xr.cftime_range(start = f'{start_yr}-01-01', end = f'{end_yr}-12-31', freq='D', calendar='noleap'))
elif extracted['time'].dt.calendar == '360_day':
# Get number of days over given period with 360 day calendar
expected_len = xr.cftime_range(start = f'{start_yr}-01-01', end = f'{end_yr}-12-31', freq='D', calendar='360_day')
expected_len = len(xr.cftime_range(start = f'{start_yr}-01-01', end = f'{end_yr}-12-31', freq='D', calendar='360_day'))
else:
# Number of months over given year range
expected_len = len(pd.date_range(start=str(start_yr) + "-01-01", end=str(end_yr) + "-12-31", freq='M'))
Expand Down

0 comments on commit cd3d107

Please sign in to comment.