You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been working with your package to retrieve a list of files for a specific radar from an AWS bucket, and ran into a problem with retrieving a list of radar scans for the current day.
Example code that throws an error:
import nexradaws as nexr
from datetime import datetime, timedelta
start_time = datetime.now().replace(hour=10, minute=0, second=0, microsecond=0)
end_time = start_time + timedelta(hours=2)
radar_id = "KEAX"
conn = nexr.NexradAwsInterface()
file_list = conn.get_avail_scans_in_range(start_time, end_time, radar_id)
>>> TypeError: 'NoneType' object is not iterable
We have linked this error to the _datetime_range() function within get_avail_scans_in_range(), which is defined as:
def _datetime_range(self, start=None, end=None):
span = end - start
if span.seconds > 0:
numdays = span.days + 1
else:
numdays = span.days
for i in range(0, numdays + 1):
yield start + timedelta(days=i)
The issue is with the +1s in the above function, and the datetime range it returns includes the current and following day to what is defined as end_time.
Therefore, if the end_time is defined as the current day, it is trying to look for files from the following day, which do not exist, and returns the TypeError. The function performs as expected for all other days that are not the current day.
Thank you for looking into this.
The text was updated successfully, but these errors were encountered:
Hello,
I've been working with your package to retrieve a list of files for a specific radar from an AWS bucket, and ran into a problem with retrieving a list of radar scans for the current day.
Example code that throws an error:
We have linked this error to the
_datetime_range()
function withinget_avail_scans_in_range()
, which is defined as:The issue is with the
+1
s in the above function, and the datetime range it returns includes the current and following day to what is defined as end_time.Therefore, if the end_time is defined as the current day, it is trying to look for files from the following day, which do not exist, and returns the
TypeError
. The function performs as expected for all other days that are not the current day.Thank you for looking into this.
The text was updated successfully, but these errors were encountered: