Suppressing Output During Download with API

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
CSDA - fpolicel
User Services
User Services
Posts: 2
Joined: Fri Jul 07, 2023 12:49 pm America/New_York
Answers: 0

Suppressing Output During Download with API

by CSDA - fpolicel » Tue Apr 16, 2024 11:42 am America/New_York

Hi,
I am downloading SWOT data using the API in Python.
I want to suppress all of the update information, and I was only partially successful with my code below.
Specically, I am still repeatedly getting "Loading widget..." as an output. I think this happens each time it downloads a dataset.
Thank you,
Fritz Policelli
NASA, GSFC

with contextlib.redirect_stdout(output_buffer), contextlib.redirect_stderr(output_buffer):
results = earthaccess.search_data(short_name = 'SWOT_L2_HR_RiverSP_2.0', bounding_box=
(x_min,y_min,x_max,y_max))
directory = 'reach_id_' + str(reach_id) + 'SWOT_data'
if not os.path.exists(directory):
os.makedirs(directory)
for result in results:
with contextlib.redirect_stdout(output_buffer), contextlib.redirect_stderr(output_buffer):
earthaccess.download([result], directory)

Tags:

Post Reply