Skip to content

Commit 785e77a

Browse files
committed
feat: use the csv.DictReader rathher than approaching with a string.split
1 parent 00db6e5 commit 785e77a

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/pygeofilter_aeronet/evaluator.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import csv
12
import os
23
import json
34
import numbers
@@ -26,13 +27,12 @@ def read_aeronet_site_list(filepath: str) -> Sequence[str]:
2627
"""
2728

2829
site_list = []
29-
with open(filepath, "r") as file:
30-
lines = file.readlines()[2:] # Skip the first two header lines
31-
for line in lines:
32-
parts = line.strip().split(",")
33-
if len(parts) >= 4:
34-
site_name = parts[0]
35-
site_list.append(site_name)
30+
with open(filepath) as file:
31+
next(file)
32+
33+
csv_reader = csv.DictReader(file)
34+
for line in csv_reader:
35+
site_list.append(line['Site_Name'])
3636

3737
return site_list
3838

0 commit comments

Comments
 (0)