Skip to content

Commit c1fc1b0

Browse files
simranmattu14Simran Mattu
and
Simran Mattu
authored
commit meesage: Updated tables-backfilling to relax the rules for certain files (#28)
Co-authored-by: Simran Mattu <[email protected]>
1 parent 173768f commit c1fc1b0

File tree

2 files changed

+82
-9
lines changed

2 files changed

+82
-9
lines changed

woudc_extcsv/__init__.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ def __init__(self, content, reporter=None):
221221

222222
LOGGER.debug('Reading into csv')
223223
self._raw = content
224+
self._raw = content.lstrip('\ufeff')
224225
reader = csv.reader(StringIO(self._raw))
225226

226227
LOGGER.debug('Parsing object model')
@@ -827,10 +828,10 @@ def parse_datestamp(self, table, datestamp, line_num):
827828
success = False
828829

829830
present_year = datetime.now().year
830-
if year is not None and year not in range(1940, present_year + 1):
831+
if year is not None and year not in range(1924, present_year + 1):
831832
if not self._add_to_report(303, line_num, table=table,
832833
component='year',
833-
lower='1940', upper='PRESENT'):
834+
lower='1924', upper='PRESENT'):
834835
success = False
835836
if month is not None and month not in range(1, 12 + 1):
836837
if not self._add_to_report(303, line_num, table=table,
@@ -1066,7 +1067,7 @@ def check_table_height(self, table, definition, num_rows):
10661067
headerline = self.line_num(table)
10671068
success = True
10681069

1069-
if num_rows == 0:
1070+
if num_rows == 0 and lower != 0:
10701071
if is_required:
10711072
if not self._add_to_report(208, headerline, table=table):
10721073
success = False
@@ -1388,9 +1389,11 @@ def validate_dataset_tables(self):
13881389
success = False
13891390

13901391
LOGGER.debug('Finished validating table {}'.format(table))
1391-
13921392
for table in extra_tables:
1393-
table_type = table.rstrip('0123456789_')
1393+
if table.startswith("SAOZ_DATA_V"):
1394+
table_type = table
1395+
else:
1396+
table_type = table.rstrip('0123456789_')
13941397
if table_type not in optional_tables and table_type != 'comments':
13951398
if not self._add_to_report(202, table=table, dataset=dataset):
13961399
success = False

woudc_extcsv/tables-backfilling.yml

+74-4
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,15 @@ Datasets:
204204
required_fields:
205205
- IntegratedO3
206206
- SondeTotalO3
207-
- BackgroundCorrection
208-
- SampleTemperatureType
209207
optional_fields:
210208
- CorrectionCode
211209
- NormalizationFactor
210+
- BackgroundCorrection
211+
- SampleTemperatureType
212212
PROFILE:
213213
rows: 1+
214214
occurrences: 1
215-
required_fields:
215+
optional_fields:
216216
- Duration
217217
- Pressure
218218
- O3PartialPressure
@@ -226,7 +226,6 @@ Datasets:
226226
- SondeCurrent
227227
- Latitude
228228
- Longitude
229-
optional_fields:
230229
- PumpMotorCurrent
231230
- PumpMotorVoltage
232231
- Height
@@ -281,6 +280,17 @@ Datasets:
281280
- MotorCurrent
282281
- HeadPressure
283282
- VacuumPressure
283+
AUXILIARY_DATA:
284+
rows: 1
285+
occurrences: 0-1
286+
optional_fields:
287+
- MeteoSonde
288+
- ib1
289+
- ib2
290+
- PumpRate
291+
- BackgroundCorr
292+
- SampleTemperatureType
293+
- MinutesGroundO3
284294
OZONE_REFERENCE:
285295
rows: 1
286296
occurrences: 0-1
@@ -293,6 +303,66 @@ Datasets:
293303
- WLCode
294304
- ObsType
295305
- UTC_Mean
306+
PRELAUNCH:
307+
rows: 1+
308+
occurrences: 0-1
309+
optional_fields:
310+
- Duration
311+
- Pressure
312+
- O3PartialPressure
313+
- Temperature
314+
- WindSpeed
315+
- WindDirection
316+
- LevelCode
317+
- GPHeight
318+
- RelativeHumidity
319+
- SampleTemperature
320+
- SondeCurrent
321+
- Latitude
322+
- Longitude
323+
- PumpMotorCurrent
324+
- PumpMotorVoltage
325+
- Height
326+
PROFILE_UNCERTAINTY:
327+
rows: 1+
328+
occurrences: 0-1
329+
optional_fields:
330+
- Duration
331+
- Pressure
332+
- O3PartialPressure
333+
- Temperature
334+
- WindSpeed
335+
- WindDirection
336+
- LevelCode
337+
- GPHeight
338+
- RelativeHumidity
339+
- SampleTemperature
340+
- SondeCurrent
341+
- Latitude
342+
- Longitude
343+
- PumpMotorCurrent
344+
- PumpMotorVoltage
345+
- Height
346+
DESELECTED_DATA:
347+
rows: 0+
348+
occurrences: 0-1
349+
optional_fields:
350+
- Duration
351+
- Pressure
352+
- O3PartialPressure
353+
- Temperature
354+
- WindSpeed
355+
- WindDirection
356+
- LevelCode
357+
- GPHeight
358+
- RelativeHumidity
359+
- SampleTemperature
360+
- SondeCurrent
361+
- Latitude
362+
- Longitude
363+
- PumpMotorCurrent
364+
- PumpMotorVoltage
365+
- Height
296366
data_table: PROFILE
297367
RocketSonde:
298368
"1.0":

0 commit comments

Comments
 (0)