@@ -63,6 +63,42 @@ def test_create_files_specifying_spatial_and_temporal_locations_of_each_example(
6363 assert len (locations_df ) == batch_size
6464
6565
66+ def test_create_files_locations_of_each_example_reduced (
67+ test_configuration_filename ,
68+ ):
69+ """Test to create locations, for a reduced number of n_gsps"""
70+
71+ manager = ManagerLive ()
72+ manager .load_yaml_configuration (filename = test_configuration_filename )
73+ manager .config .process .batch_size = 5
74+ manager .config .process .split_method = SplitMethod .SAME
75+ manager .initialize_data_sources ()
76+ t0_datetime = datetime (2021 , 4 , 1 )
77+
78+ batch_size = manager .config .process .batch_size
79+
80+ with tempfile .TemporaryDirectory () as local_temp_path , tempfile .TemporaryDirectory () as dst_path : # noqa 101
81+
82+ manager .config .output_data .filepath = Path (dst_path )
83+ manager .local_temp_path = Path (local_temp_path )
84+
85+ manager .create_files_specifying_spatial_and_temporal_locations_of_each_example (
86+ t0_datetime = t0_datetime , n_gsps = 7
87+ ) # noqa 101
88+
89+ live_file = f"{ dst_path } /live/{ SPATIAL_AND_TEMPORAL_LOCATIONS_OF_EACH_EXAMPLE_FILENAME } "
90+
91+ assert os .path .exists (live_file )
92+ locations_df = pd .read_csv (live_file )
93+ # we've asked for 7 examples, but the batchsize is 5, so we get 10 examples,
94+ # the last 3 being filled in
95+ assert len (locations_df ) == batch_size * 2
96+ # check last 3 are filled in from the first one
97+ assert locations_df .iloc [- 3 ].id == 1
98+ assert locations_df .iloc [- 2 ].id == 1
99+ assert locations_df .iloc [- 1 ].id == 1
100+
101+
66102def test_batches (test_configuration_filename , sat , gsp ):
67103 """Test that batches can be made"""
68104
0 commit comments