Skip to content

Commit 164cfb3

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent e129b8e commit 164cfb3

File tree

3 files changed

+78
-92
lines changed

3 files changed

+78
-92
lines changed

disdrodb/l0/routines.py

Lines changed: 48 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -220,26 +220,24 @@ def run_disdrodb_l0a_station(
220220
):
221221
"""Run the L0A processing of a station calling the disdrodb_l0a_station in the terminal."""
222222
# Define command
223-
cmd = " ".join(
224-
[
225-
"disdrodb_run_l0a_station",
226-
# Station arguments
227-
data_source,
228-
campaign_name,
229-
station_name,
230-
# Processing options
231-
"--force",
232-
str(force),
233-
"--verbose",
234-
str(verbose),
235-
"--debugging_mode",
236-
str(debugging_mode),
237-
"--parallel",
238-
str(parallel),
239-
"--base_dir",
240-
str(base_dir),
241-
]
242-
)
223+
cmd = " ".join([
224+
"disdrodb_run_l0a_station",
225+
# Station arguments
226+
data_source,
227+
campaign_name,
228+
station_name,
229+
# Processing options
230+
"--force",
231+
str(force),
232+
"--verbose",
233+
str(verbose),
234+
"--debugging_mode",
235+
str(debugging_mode),
236+
"--parallel",
237+
str(parallel),
238+
"--base_dir",
239+
str(base_dir),
240+
])
243241
# Execute command
244242
_execute_cmd(cmd)
245243
return None
@@ -259,26 +257,24 @@ def run_disdrodb_l0b_station(
259257
):
260258
"""Run the L0B processing of a station calling disdrodb_run_l0b_station in the terminal."""
261259
# Define command
262-
cmd = " ".join(
263-
[
264-
"disdrodb_run_l0b_station",
265-
# Station arguments
266-
data_source,
267-
campaign_name,
268-
station_name,
269-
# Processing options
270-
"--force",
271-
str(force),
272-
"--verbose",
273-
str(verbose),
274-
"--debugging_mode",
275-
str(debugging_mode),
276-
"--parallel",
277-
str(parallel),
278-
"--base_dir",
279-
str(base_dir),
280-
]
281-
)
260+
cmd = " ".join([
261+
"disdrodb_run_l0b_station",
262+
# Station arguments
263+
data_source,
264+
campaign_name,
265+
station_name,
266+
# Processing options
267+
"--force",
268+
str(force),
269+
"--verbose",
270+
str(verbose),
271+
"--debugging_mode",
272+
str(debugging_mode),
273+
"--parallel",
274+
str(parallel),
275+
"--base_dir",
276+
str(base_dir),
277+
])
282278
# Execute command
283279
_execute_cmd(cmd)
284280
return None
@@ -296,20 +292,18 @@ def run_disdrodb_l0b_concat_station(
296292
297293
This function runs the ``disdrodb_run_l0b_concat_station`` script in the terminal.
298294
"""
299-
cmd = " ".join(
300-
[
301-
"disdrodb_run_l0b_concat_station",
302-
data_source,
303-
campaign_name,
304-
station_name,
305-
"--remove_l0b",
306-
str(remove_l0b),
307-
"--verbose",
308-
str(verbose),
309-
"--base_dir",
310-
str(base_dir),
311-
]
312-
)
295+
cmd = " ".join([
296+
"disdrodb_run_l0b_concat_station",
297+
data_source,
298+
campaign_name,
299+
station_name,
300+
"--remove_l0b",
301+
str(remove_l0b),
302+
"--verbose",
303+
str(verbose),
304+
"--base_dir",
305+
str(base_dir),
306+
])
313307
_execute_cmd(cmd)
314308

315309

disdrodb/tests/test_l0/test_l0a_processing.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,11 @@ def test_is_not_corrupted():
300300

301301
def test_cast_column_dtypes():
302302
# Create a test dataframe with object columns
303-
df = pd.DataFrame(
304-
{
305-
"time": ["2022-01-01 00:00:00", "2022-01-01 00:05:00", "2022-01-01 00:10:00"],
306-
"station_number": "station_number",
307-
"altitude": "8849",
308-
}
309-
)
303+
df = pd.DataFrame({
304+
"time": ["2022-01-01 00:00:00", "2022-01-01 00:05:00", "2022-01-01 00:10:00"],
305+
"station_number": "station_number",
306+
"altitude": "8849",
307+
})
310308
# Call the function
311309
sensor_name = "OTT_Parsivel"
312310
df_out = cast_column_dtypes(df, sensor_name, verbose=False)
@@ -552,12 +550,12 @@ def test_read_raw_files():
552550
verbose = False
553551

554552
# Create a test dataframe
555-
df1 = pd.DataFrame(
556-
{"time": pd.date_range(start="2022-01-01", end="2022-01-02", freq="H"), "value": np.random.rand(25)}
557-
)
558-
df2 = pd.DataFrame(
559-
{"time": pd.date_range(start="2022-01-03", end="2022-01-04", freq="H"), "value": np.random.rand(25)}
560-
)
553+
df1 = pd.DataFrame({
554+
"time": pd.date_range(start="2022-01-01", end="2022-01-02", freq="H"), "value": np.random.rand(25)
555+
})
556+
df2 = pd.DataFrame({
557+
"time": pd.date_range(start="2022-01-03", end="2022-01-04", freq="H"), "value": np.random.rand(25)
558+
})
561559
df_list = [df1, df2]
562560

563561
# Mock the process_raw_file function

disdrodb/tests/test_l0/test_l0b_processing.py

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,15 @@ def define_test_dummy_configs():
9696
@pytest.mark.parametrize("create_test_config_files", [define_test_dummy_configs()], indirect=True)
9797
def test_create_l0b_from_l0a(create_test_config_files):
9898
# Create a sample DataFrame
99-
df = pd.DataFrame(
100-
{
101-
"time": pd.date_range("2022-01-01", periods=10, freq="H"),
102-
"raw_drop_concentration": np.random.rand(10),
103-
"raw_drop_average_velocity": np.random.rand(10),
104-
"raw_drop_number": np.random.rand(10),
105-
"latitude": np.random.rand(10),
106-
"longitude": np.random.rand(10),
107-
"altitude": np.random.rand(10),
108-
}
109-
)
99+
df = pd.DataFrame({
100+
"time": pd.date_range("2022-01-01", periods=10, freq="H"),
101+
"raw_drop_concentration": np.random.rand(10),
102+
"raw_drop_average_velocity": np.random.rand(10),
103+
"raw_drop_number": np.random.rand(10),
104+
"latitude": np.random.rand(10),
105+
"longitude": np.random.rand(10),
106+
"altitude": np.random.rand(10),
107+
})
110108
# Create a sample attrs dictionary
111109
attrs = {
112110
"sensor_name": "test",
@@ -149,13 +147,11 @@ def test_create_l0b_from_l0a(create_test_config_files):
149147

150148
def test_add_dataset_crs_coords():
151149
# Create example dataset
152-
ds = xr.Dataset(
153-
{
154-
"var1": xr.DataArray([1, 2, 3], dims="time"),
155-
"lat": xr.DataArray([0, 1, 2], dims="time"),
156-
"lon": xr.DataArray([0, 1, 2], dims="time"),
157-
}
158-
)
150+
ds = xr.Dataset({
151+
"var1": xr.DataArray([1, 2, 3], dims="time"),
152+
"lat": xr.DataArray([0, 1, 2], dims="time"),
153+
"lon": xr.DataArray([0, 1, 2], dims="time"),
154+
})
159155

160156
# Call the function and check the output
161157
ds_out = add_dataset_crs_coords(ds)
@@ -181,13 +177,11 @@ def test_set_attrs_dict():
181177

182178
def test__set_coordinate_attributes():
183179
# Create example dataset
184-
ds = xr.Dataset(
185-
{
186-
"var1": xr.DataArray([1, 2, 3], dims="time"),
187-
"lat": xr.DataArray([0, 1, 2], dims="time"),
188-
"lon": xr.DataArray([0, 1, 2], dims="time"),
189-
}
190-
)
180+
ds = xr.Dataset({
181+
"var1": xr.DataArray([1, 2, 3], dims="time"),
182+
"lat": xr.DataArray([0, 1, 2], dims="time"),
183+
"lon": xr.DataArray([0, 1, 2], dims="time"),
184+
})
191185
ds.lat.attrs["units"] = "degrees_north"
192186
ds.lon.attrs["units"] = "degrees_east"
193187

0 commit comments

Comments
 (0)