diff --git a/disdrodb/l0/routines.py b/disdrodb/l0/routines.py index 5fb29d2a..3fe1c89e 100644 --- a/disdrodb/l0/routines.py +++ b/disdrodb/l0/routines.py @@ -220,26 +220,24 @@ def run_disdrodb_l0a_station( ): """Run the L0A processing of a station calling the disdrodb_l0a_station in the terminal.""" # Define command - cmd = " ".join( - [ - "disdrodb_run_l0a_station", - # Station arguments - data_source, - campaign_name, - station_name, - # Processing options - "--force", - str(force), - "--verbose", - str(verbose), - "--debugging_mode", - str(debugging_mode), - "--parallel", - str(parallel), - "--base_dir", - str(base_dir), - ] - ) + cmd = " ".join([ + "disdrodb_run_l0a_station", + # Station arguments + data_source, + campaign_name, + station_name, + # Processing options + "--force", + str(force), + "--verbose", + str(verbose), + "--debugging_mode", + str(debugging_mode), + "--parallel", + str(parallel), + "--base_dir", + str(base_dir), + ]) # Execute command _execute_cmd(cmd) return None @@ -259,26 +257,24 @@ def run_disdrodb_l0b_station( ): """Run the L0B processing of a station calling disdrodb_run_l0b_station in the terminal.""" # Define command - cmd = " ".join( - [ - "disdrodb_run_l0b_station", - # Station arguments - data_source, - campaign_name, - station_name, - # Processing options - "--force", - str(force), - "--verbose", - str(verbose), - "--debugging_mode", - str(debugging_mode), - "--parallel", - str(parallel), - "--base_dir", - str(base_dir), - ] - ) + cmd = " ".join([ + "disdrodb_run_l0b_station", + # Station arguments + data_source, + campaign_name, + station_name, + # Processing options + "--force", + str(force), + "--verbose", + str(verbose), + "--debugging_mode", + str(debugging_mode), + "--parallel", + str(parallel), + "--base_dir", + str(base_dir), + ]) # Execute command _execute_cmd(cmd) return None @@ -296,20 +292,18 @@ def run_disdrodb_l0b_concat_station( This function runs the ``disdrodb_run_l0b_concat_station`` script in the terminal. """ - cmd = " ".join( - [ - "disdrodb_run_l0b_concat_station", - data_source, - campaign_name, - station_name, - "--remove_l0b", - str(remove_l0b), - "--verbose", - str(verbose), - "--base_dir", - str(base_dir), - ] - ) + cmd = " ".join([ + "disdrodb_run_l0b_concat_station", + data_source, + campaign_name, + station_name, + "--remove_l0b", + str(remove_l0b), + "--verbose", + str(verbose), + "--base_dir", + str(base_dir), + ]) _execute_cmd(cmd) diff --git a/disdrodb/tests/test_l0/test_l0a_processing.py b/disdrodb/tests/test_l0/test_l0a_processing.py index 65dff9da..5178656c 100644 --- a/disdrodb/tests/test_l0/test_l0a_processing.py +++ b/disdrodb/tests/test_l0/test_l0a_processing.py @@ -300,13 +300,11 @@ def test_is_not_corrupted(): def test_cast_column_dtypes(): # Create a test dataframe with object columns - df = pd.DataFrame( - { - "time": ["2022-01-01 00:00:00", "2022-01-01 00:05:00", "2022-01-01 00:10:00"], - "station_number": "station_number", - "altitude": "8849", - } - ) + df = pd.DataFrame({ + "time": ["2022-01-01 00:00:00", "2022-01-01 00:05:00", "2022-01-01 00:10:00"], + "station_number": "station_number", + "altitude": "8849", + }) # Call the function sensor_name = "OTT_Parsivel" df_out = cast_column_dtypes(df, sensor_name, verbose=False) @@ -552,12 +550,12 @@ def test_read_raw_files(): verbose = False # Create a test dataframe - df1 = pd.DataFrame( - {"time": pd.date_range(start="2022-01-01", end="2022-01-02", freq="H"), "value": np.random.rand(25)} - ) - df2 = pd.DataFrame( - {"time": pd.date_range(start="2022-01-03", end="2022-01-04", freq="H"), "value": np.random.rand(25)} - ) + df1 = pd.DataFrame({ + "time": pd.date_range(start="2022-01-01", end="2022-01-02", freq="H"), "value": np.random.rand(25) + }) + df2 = pd.DataFrame({ + "time": pd.date_range(start="2022-01-03", end="2022-01-04", freq="H"), "value": np.random.rand(25) + }) df_list = [df1, df2] # Mock the process_raw_file function diff --git a/disdrodb/tests/test_l0/test_l0b_processing.py b/disdrodb/tests/test_l0/test_l0b_processing.py index 55053de6..81604799 100644 --- a/disdrodb/tests/test_l0/test_l0b_processing.py +++ b/disdrodb/tests/test_l0/test_l0b_processing.py @@ -96,17 +96,15 @@ def define_test_dummy_configs(): @pytest.mark.parametrize("create_test_config_files", [define_test_dummy_configs()], indirect=True) def test_create_l0b_from_l0a(create_test_config_files): # Create a sample DataFrame - df = pd.DataFrame( - { - "time": pd.date_range("2022-01-01", periods=10, freq="H"), - "raw_drop_concentration": np.random.rand(10), - "raw_drop_average_velocity": np.random.rand(10), - "raw_drop_number": np.random.rand(10), - "latitude": np.random.rand(10), - "longitude": np.random.rand(10), - "altitude": np.random.rand(10), - } - ) + df = pd.DataFrame({ + "time": pd.date_range("2022-01-01", periods=10, freq="H"), + "raw_drop_concentration": np.random.rand(10), + "raw_drop_average_velocity": np.random.rand(10), + "raw_drop_number": np.random.rand(10), + "latitude": np.random.rand(10), + "longitude": np.random.rand(10), + "altitude": np.random.rand(10), + }) # Create a sample attrs dictionary attrs = { "sensor_name": "test", @@ -149,13 +147,11 @@ def test_create_l0b_from_l0a(create_test_config_files): def test_add_dataset_crs_coords(): # Create example dataset - ds = xr.Dataset( - { - "var1": xr.DataArray([1, 2, 3], dims="time"), - "lat": xr.DataArray([0, 1, 2], dims="time"), - "lon": xr.DataArray([0, 1, 2], dims="time"), - } - ) + ds = xr.Dataset({ + "var1": xr.DataArray([1, 2, 3], dims="time"), + "lat": xr.DataArray([0, 1, 2], dims="time"), + "lon": xr.DataArray([0, 1, 2], dims="time"), + }) # Call the function and check the output ds_out = add_dataset_crs_coords(ds) @@ -181,13 +177,11 @@ def test_set_attrs_dict(): def test__set_coordinate_attributes(): # Create example dataset - ds = xr.Dataset( - { - "var1": xr.DataArray([1, 2, 3], dims="time"), - "lat": xr.DataArray([0, 1, 2], dims="time"), - "lon": xr.DataArray([0, 1, 2], dims="time"), - } - ) + ds = xr.Dataset({ + "var1": xr.DataArray([1, 2, 3], dims="time"), + "lat": xr.DataArray([0, 1, 2], dims="time"), + "lon": xr.DataArray([0, 1, 2], dims="time"), + }) ds.lat.attrs["units"] = "degrees_north" ds.lon.attrs["units"] = "degrees_east"