Skip to content

Commit fd089be

Browse files
committed
MAINT: updated datetime.utcnow
Changed datetime calls to `utcnow`, as it has been deprecated.
1 parent bdd7378 commit fd089be

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

pysatMadrigal/instruments/gnss_tec.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@ def load(fnames, tag='', inst_id='', los_method='site', los_value=None,
354354

355355

356356
def list_remote_files(tag, inst_id, start=dt.datetime(1998, 10, 15),
357-
stop=dt.datetime.utcnow(), user=None, password=None):
357+
stop=dt.datetime.now(tz=dt.timezone.utc), user=None,
358+
password=None):
358359
"""Create a Pandas Series of every file for chosen remote data.
359360
360361
Parameters
@@ -367,10 +368,10 @@ def list_remote_files(tag, inst_id, start=dt.datetime(1998, 10, 15),
367368
provided by pysat itself.
368369
start : dt.datetime or NoneType
369370
Starting time for file list. If None, replaced with default.
370-
(default=10-15-1998)
371+
(default=dt.datetime(1998, 10, 15))
371372
stop : dt.datetime or NoneType
372373
Ending time for the file list. If None, replaced with default.
373-
(default=time of run)
374+
(default=dt.datetime.now(tz=dt.timezone.utc))
374375
user : str or NoneType
375376
Username to be passed along to resource with relevant data.
376377
(default=None)

pysatMadrigal/instruments/madrigal_dst.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
madrigal_inst_code = 212
6868
madrigal_tag = {'': {'': "30006"}}
6969
madrigal_start = dt.datetime(1957, 1, 1)
70-
madrigal_end = dt.datetime.utcnow()
70+
madrigal_end = dt.datetime.now(tz=dt.timezone.utc)
7171

7272
# Local attributes
7373
#

pysatMadrigal/instruments/madrigal_geoind.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
madrigal_inst_code = 210
6868
madrigal_tag = {'': {'': "30007"}}
6969
madrigal_start = dt.datetime(1950, 1, 1)
70-
madrigal_end = dt.datetime.utcnow()
70+
madrigal_end = dt.datetime.now(tz=dt.timezone.utc)
7171

7272
# Local attributes
7373
#

pysatMadrigal/instruments/madrigal_pandas.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ def download(date_array, tag, inst_id, data_path, user=None, password=None,
292292

293293
def list_remote_files(tag, inst_id, kindat='', user=None, password=None,
294294
url="http://cedar.openmadrigal.org",
295-
start=dt.datetime(1900, 1, 1), stop=dt.datetime.utcnow()):
295+
start=dt.datetime(1900, 1, 1),
296+
stop=dt.datetime.now(tz=dt.timezone.utc)):
296297
"""List files available from Madrigal.
297298
298299
Parameters
@@ -320,7 +321,8 @@ def list_remote_files(tag, inst_id, kindat='', user=None, password=None,
320321
start : dt.datetime
321322
Starting time for file list (default=dt.datetime(1900, 1, 1))
322323
stop : dt.datetime
323-
Ending time for the file list (default=dt.datetime.utcnow())
324+
Ending time for the file list
325+
(default=dt.datetime.now(tz=dt.timezone.utc))
324326
325327
Returns
326328
-------

pysatMadrigal/instruments/methods/general.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ def get_remote_filenames(inst_code=None, kindat='', user=None, password=None,
10531053
(default=dt.datetime(1900, 1, 1))
10541054
stop : dt.datetime or NoneType
10551055
Ending time for the file list, None reverts to default
1056-
(default=dt.datetime.utcnow())
1056+
(default=dt.datetime.now(tz=dt.timezone.utc))
10571057
date_array : dt.datetime or NoneType
10581058
Array of datetimes to download data for. The sequence of dates need not
10591059
be contiguous and will be used instead of start and stop if supplied.
@@ -1102,7 +1102,7 @@ def get_remote_filenames(inst_code=None, kindat='', user=None, password=None,
11021102
start = dt.datetime(1900, 1, 1)
11031103

11041104
if stop is None:
1105-
stop = dt.datetime.utcnow()
1105+
stop = dt.datetime.now(tz=dt.timezone.utc)
11061106

11071107
# If start and stop are identical, increment
11081108
if start == stop:
@@ -1178,7 +1178,7 @@ def list_remote_files(tag, inst_id, inst_code=None, kindats=None, user=None,
11781178
password=None, supported_tags=None,
11791179
url="http://cedar.openmadrigal.org",
11801180
two_digit_year_break=None, start=dt.datetime(1900, 1, 1),
1181-
stop=dt.datetime.utcnow()):
1181+
stop=dt.datetime.now(tz=dt.timezone.utc)):
11821182
"""List files available from Madrigal.
11831183
11841184
Parameters

pysatMadrigal/tests/test_methods_general.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ def setup_method(self):
817817
"""Create a clean testing environment."""
818818
self.exp = None
819819
self.start = dt.datetime(1950, 1, 1)
820-
self.stop = dt.datetime.utcnow()
820+
self.stop = dt.datetime.now(tz=dt.timezone.utc)
821821
return
822822

823823
def teardown_method(self):

0 commit comments

Comments
 (0)