As I understand, in the cdsapi.Client class, the quiet parameter is designed to control the logging behavior. When set to True, the class should not print logs, and when set to False, it should print logs. However, there is a specific scenario where the logging continues even after changing the quiet parameter from True back to False.
Expected Behavior:
When the quiet parameter is set to True, logging should be suppressed. When the quiet parameter is set to False, logs should be printed. The logging behavior should correctly reflect the value of the quiet parameter at all times.
Actual Behavior:
Logs continue to be printed even when the quiet parameter is set to False after a previous setting of True.
Proposed Solution:
I have identified the root cause of this issue and have a patch ready to resolve it. I will submit a PR shortly.
What are the steps to reproduce the bug?
Set quiet parameter to True.
Perform actions using the cdsapi.Client class.
Change the quiet parameter back to False.
Observe that logs are still being printed, even though quiet is now False.
I have used the following piece of code to reproduce this behavior:
QUIET: True
QUIET: False
2023-10-05 16:21:23,692 INFO Welcome to the CDS
2023-10-05 16:21:23,692 INFO Sending request to https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-land
2023-10-05 16:21:23,773 INFO Request is queued
2023-10-05 16:21:24,849 INFO Request is completed
2023-10-05 16:21:24,849 INFO Downloading https://download-0012-clone.copernicus-climate.eu/cache-compute-0012/cache/data0/adaptor.mars.internal-1696501013.798142-21806-11-09e10a51-2661-43a7-9100-13c4f5256cca.nc to ./cds_test.nc (27K)
2023-10-05 16:21:25,008 INFO Download rate 168.8K/s
QUIET: True
2023-10-05 16:21:25,155 INFO Welcome to the CDS
2023-10-05 16:21:25,155 INFO Sending request to https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-land
2023-10-05 16:21:25,256 INFO Request is queued
2023-10-05 16:21:26,334 INFO Request is completed
2023-10-05 16:21:26,334 INFO Downloading https://download-0012-clone.copernicus-climate.eu/cache-compute-0012/cache/data0/adaptor.mars.internal-1696501013.798142-21806-11-09e10a51-2661-43a7-9100-13c4f5256cca.nc to ./cds_test.nc (27K)
2023-10-05 16:21:26,488 INFO Download rate 175.8K/s
QUIET: False
2023-10-05 16:21:26,642 INFO Welcome to the CDS
2023-10-05 16:21:26,658 INFO Sending request to https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-land
2023-10-05 16:21:26,766 INFO Request is queued
2023-10-05 16:21:27,836 INFO Request is completed
2023-10-05 16:21:27,851 INFO Downloading https://download-0012-clone.copernicus-climate.eu/cache-compute-0012/cache/data0/adaptor.mars.internal-1696501013.798142-21806-11-09e10a51-2661-43a7-9100-13c4f5256cca.nc to ./cds_test.nc (27K)
2023-10-05 16:21:28,002 INFO Download rate 180.6K/s
What happened?
As I understand, in the
cdsapi.Client
class, thequiet
parameter is designed to control the logging behavior. When set toTrue
, the class should not print logs, and when set toFalse
, it should print logs. However, there is a specific scenario where the logging continues even after changing the quiet parameter fromTrue
back toFalse
.Expected Behavior: When the
quiet
parameter is set toTrue
, logging should be suppressed. When thequiet
parameter is set toFalse
, logs should be printed. The logging behavior should correctly reflect the value of thequiet
parameter at all times.Actual Behavior: Logs continue to be printed even when the
quiet
parameter is set toFalse
after a previous setting ofTrue
.Proposed Solution: I have identified the root cause of this issue and have a patch ready to resolve it. I will submit a PR shortly.
What are the steps to reproduce the bug?
quiet
parameter toTrue
.cdsapi.Client
class.False
.quiet
is nowFalse
.I have used the following piece of code to reproduce this behavior:
Version
v0.6.1
Platform (OS and architecture)
Windows 11 Home (22H2 version, 64-bit)
Relevant log output
Accompanying data
No response
Organisation
No response