Skip to content

Commit

Permalink
Add time period check (#290)
Browse files Browse the repository at this point in the history
* Add time period check to CI

* Update time period check

* Don't check multi time periods

* Update ampersand usage in solarstation.csv

* Update ampersand usage
  • Loading branch information
AdamRJensen authored Feb 11, 2025
1 parent 6433cab commit 8cdbe4b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 9 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/validate-csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,48 @@ def check_instrumentation(row):
return f"Not a valid entry for Instrumentation: {instrument}"


def check_time_period(row):
time_period = row['Time period']
if len(time_period) == 4:
try:
int(time_period)
except ValueError:
return f"Not a valid time period: {time_period}"
elif (len(time_period) == 5) | (len(time_period) == 6):
if time_period.endswith('-') | time_period.endswith('-?'):
try:
int(time_period[:4])
except ValueError:
return f"Not a valid time period: {time_period}"
elif time_period.startswith('-') | time_period.startswith('?-'):
try:
int(time_period[-4:])
except ValueError:
return f"Not a valid time period: {time_period}"
else:
return f"Not a valid time period: {time_period}"
elif len(time_period) == 9:
try:
int(time_period[:4])
int(time_period[-4:])
except ValueError:
return f"Not a valid time period: {time_period}"
elif len(time_period) > 9:
pass # unable to assess the time period, e.g., "2020-2022&2023-"
elif time_period == '?':
pass
else:
return f"Not a valid time period: {time_period}"


validation_functions = [
check_country,
check_url,
check_elevation,
check_coordinates,
check_data_availability,
check_instrumentation,
check_time_period,
]

if __name__ == "__main__":
Expand Down
18 changes: 9 additions & 9 deletions solarstations.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Abashiri,ABS,,Japan,44.0178,144.2797,38,2021-,BSRN,,,,Freely,G;B;D
Alert,ALE,Lincoln Sea,Canada,82.49,-62.42,127,2004-2014,BSRN,,,,Freely,G;B;D
Alice Springs,ASP,Northern Territory,Australia,-23.7951,133.8890,546,1995-,BSRN,BOM,,http://www.bom.gov.au/climate/data/oneminsolar/about-IDCJAC0022.shtml,Freely,G;B;D;IR
Barrow,BAR,Alaska,USA,71.323,-156.607,8,1992-,BSRN; ABO,NOAA,,https://gml.noaa.gov/obop/brw/,Freely,G;B;D
Bermuda,BER,Bermuda,USA,32.267,-64.667,8,1992-2013& 2016-,BSRN,,,,Freely,G;B;D
Bermuda,BER,Bermuda,USA,32.267,-64.667,8,1992-2013&2016-,BSRN,,,,Freely,G;B;D
Billings,BIL,Oklahoma,USA,36.605,-97.516,317,1993-,BSRN,,,,Freely,G;B;D
Bondville,BON,Illinois,USA,40.05192,-88.37309,230,1995-,BSRN; SURFRAD,NOAA,,http://www.srrb.noaa.gov/surfrad/bondvill.html,Freely,G;B;D
Boulder,BOS,Colorado,USA,40.12498,-105.23680,1689,1995-,BSRN; SURFRAD,NOAA,,https://gml.noaa.gov/grad/surfrad/tablemt.html,Freely,G;B;D
Expand All @@ -19,7 +19,7 @@ Cener,CNR,Navarra,Spain,42.816,-1.601,471,2009-,BSRN,,,,Freely,G;B;D
Cocos Island,COC,Cocos (Keeling) Islands,Australia,-12.1892,96.8344,3,2004-,BSRN,BOM,,http://www.bom.gov.au/climate/data/oneminsolar/about-IDCJAC0022.shtml,Freely,G;B;D
De Aar,DAA,,South Africa,-30.6667,23.993,1287,2000-,BSRN,,,,Freely,G;B;D
Darwin,DAR,Northern Territory,Australia,-12.4239,130.8925,30.4,2002-2021,BSRN,BOM,BSRN data available until 2015,http://www.bom.gov.au/climate/data/oneminsolar/about-IDCJAC0022.shtml,Freely,G;B;D;IR
Concordia Station& Dome C,DOM,,Antarctica,-75.1,123.383,3233,2006-,BSRN,,,,Freely,G;B;D
Concordia Station & Dome C,DOM,,Antarctica,-75.1,123.383,3233,2006-,BSRN,,,,Freely,G;B;D
Dongsha Atoll,DON,,Taiwan,20.7,116.73,2,?,BSRN,,Candidate,,Freely,G;B;D
Desert Rock,DRA,Nevada,USA,36.62373,-116.01947,1007,1994-,BSRN; SURFRAD,NOAA,,https://gml.noaa.gov/grad/surfrad/desrock.html,Freely,G;B;D
Darwin Met Office,DWN,Northern Territory,Australia,-12.424,130.8925,32,2008-,BSRN,,,,Freely,G;B;D
Expand All @@ -29,13 +29,13 @@ Eureka,EUR,Ellesmere Island,Canada,79.989,-85.9404,85,2007-2011,BSRN,,,"https://
Florianopolis,FLO;FLN,,Brazil,-27.6017,-48.5178,31,1994-2005&2013-,BSRN;SONDA,INPE,SONDA station (2004-2019). No maintenance between 2016-2017.,http://sonda.ccst.inpe.br/basedados/florianopolis.html,Freely,G;B;D;IR
Fort Peck,FPE,Montana,USA,48.30783,-105.10170,634,1995-,BSRN;SURFRAD,NOAA,,https://gml.noaa.gov/grad/surfrad/ftpeck.html,Freely,G;B;D
Fukuoka,FUA,,Japan,33.5822,130.3764,3,2010-,BSRN,,,https://epic.awi.de/id/eprint/36862/41/Fukuoka_old-and-new.pdf,Freely,G;B;D
Gandhinagar,GAN,,India,23.1101,72.6276,65,2014-2015& 2018-,BSRN;SRRA,National Institute of wind energy,,,Freely,G;B;D
Gandhinagar,GAN,,India,23.1101,72.6276,65,2014-2015&2018-,BSRN;SRRA,National Institute of wind energy,,,Freely,G;B;D
Goodwin Creek,GCR,Mississippi,USA,34.2547,-89.8729,98,1995-,BSRN;SURFRAD,NOAA,,https://gml.noaa.gov/grad/surfrad/goodwin.html,Freely,G;B;D
Granite Island,GIM,Michigan,USA,46.721,-87.411,208,2019-,BSRN,NASA,,https://science.larc.nasa.gov/crave/,Freely,G;B;D
Gobabeb,GOB,Namib Desert,Namibia,-23.5614,15.042,407,2012-,BSRN,,,,Freely,G;B;D
Gurgaon,GUR,,India,28.4249,77.156,259,2014-2015& 2018-,BSRN;SRRA,National Institute of wind energy,,,Freely,G;B;D
Georg von Neumayer,GVN,Dronning Maud Island,Antarctica,-70.65,-8.25,42,1982-,BSRN,,Neumayer-station II from 1992-2009& Neumayer station III from 2009. BSRN FTP server only has data from 1992.,https://www.awi.de/en/science/long-term-observations/atmosphere/antarctic-neumayer.html,Freely,G;B;D
Howrah,HOW,,India,22.5535,88.3064,51,2014-2016& 2018-,BSRN;SRRA,National Institute of wind energy,,,Freely,G;B;D
Gurgaon,GUR,,India,28.4249,77.156,259,2014-2015&2018-,BSRN;SRRA,National Institute of wind energy,,,Freely,G;B;D
Georg von Neumayer,GVN,Dronning Maud Island,Antarctica,-70.65,-8.25,42,1982-,BSRN,,Neumayer-station II from 1992-2009 & Neumayer station III from 2009. BSRN FTP server only has data from 1992.,https://www.awi.de/en/science/long-term-observations/atmosphere/antarctic-neumayer.html,Freely,G;B;D
Howrah,HOW,,India,22.5535,88.3064,51,2014-2016&2018-,BSRN;SRRA,National Institute of wind energy,,,Freely,G;B;D
Ilorin,ILO,,Nigeria,8.5333,4.5667,350,1992-2005,BSRN,,Station closed due to no funding,,Freely,G;B;D
Ishigakijima,ISH,,Japan,24.3367,124.1644,5.7,2010-,BSRN,,,,Freely,G;B;D
Izaña,IZA,Tenerife,Spain,28.3093,-16.4993,2372.9,2009-,BSRN,,,,Freely,G;B;D
Expand All @@ -54,7 +54,7 @@ Nauru Island,NAU,,Nauru,-0.521,166.9167,7,1998-2013,BSRN,,,,Freely,G;B;D
Newcastle,NEW,New South Wales,Australia,-32.8842,151.7289,18.5,2017-,BSRN,,,,Freely,G;B;D
Ny-Ålesund,NYA,Spitsberger,Norway,78.925,11.93,11,1992-,BSRN,,,https://www.awi.de/en/fleet-stations/stations/awipev-arctic-research-base.html,Freely,G;B;D
Observatory of Huancayo,OHY,,Peru,-12.05,-75.32,3314,2017-,BSRN,,,,Freely,G;B;D
Palaiseau& SIRTA Observatory,PAL,,France,48.713,2.208,156,2003-,BSRN,,,,Freely,G;B;D
Palaiseau & SIRTA Observatory,PAL,,France,48.713,2.208,156,2003-,BSRN,,,,Freely,G;B;D
Paramaribo,PAR,,Suriname,5.806,-55.2146,4,2019-,BSRN,,,,Freely,G;B;D
Payerne,PAY,,Switzerland,46.8123,6.9422,491,1992-,BSRN,MeteoSwiss,,,Freely,G;B;D
Rock Springs,PSU,Pennsylvania,USA,40.72012,-77.93085,376,1998-,BSRN;SURFRAD,NOAA,SURFRAD station known as Penn State,https://gml.noaa.gov/grad/surfrad/pennstat.html,Freely,G;B;D
Expand All @@ -77,7 +77,7 @@ Tiksi,TIK,Siberia,Russia,71.5862,128.9188,48,2010-,BSRN,,,,Freely,G;B;D
Tiruvallur,TIR,,India,13.0923,79.9738,36,2014-,BSRN;SRRA,National Institute of wind energy,,,Freely,G;B;D
Terra Nova Bay,TNB,,Antarctica,-74.6223,164.2283,28,?,BSRN,,Candidate Station (no. 89),,Freely,G;B;D
Toravere,TOR,,Estonia,58.254,26.462,70,1999-,BSRN,,,https://gml.noaa.gov/grad/meetings/BSRN2018_documents/2018_%20BSRN_poster_EST_Rosin.pdf,Freely,G;B;D
Xianghe,XIA,,China,39.754,116.962,32,2005-2016,BSRN,,Station obstructed& no longer in BSRN since 2016,,Freely,G;B;D
Xianghe,XIA,,China,39.754,116.962,32,2005-2016,BSRN,,Station obstructed & no longer in BSRN since 2016,,Freely,G;B;D
Yushan Station,YUS,,Taiwan,23.4876,120.9595,3858,2018-,BSRN,,,,Freely,G;B;D
Albuquerque,ABQ,New Mexico,USA,35.03796,-106.62211,1617,1995-,SOLRAD,NOAA,,https://gml.noaa.gov/grad/solrad/abq.html,Freely,G;B;D
Bismarck,BIS,North Dakota,USA,46.77179,-100.75955,503,1995-,SOLRAD,NOAA,,https://gml.noaa.gov/grad/solrad/bis.html,Freely,G;B;D
Expand All @@ -86,7 +86,7 @@ Madison,MSN,Wisconsin,USA,43.0725,-89.41133,271,1996-,SOLRAD,NOAA,Madison statio
Oak Ridge,ORT,Tennessee,USA,35.96101,-84.28838,334,1995-2007,SOLRAD,NOAA,,https://gml.noaa.gov/grad/solrad/ort.html,Freely,G;B;D
Salt Lake City,SLC,Utah,USA,40.7722,-111.95495,1288,1995-,SOLRAD,NOAA,,https://gml.noaa.gov/grad/solrad/slc.html,Freely,G;B;D
Seattle,SEA,Washington,USA,47.68685,-122.25667,20,1995-,SOLRAD,NOAA,,https://gml.noaa.gov/grad/solrad/sea.html,Freely,G;B;D
Sterling,STE,Virginia,USA,38.97203,-77.48690,85,1995-,SOLRAD,NOAA,Site location pre Oct 28& 2014 (38.97673& -77.48379),https://gml.noaa.gov/grad/solrad/ste.html,Freely,G;B;D
Sterling,STE,Virginia,USA,38.97203,-77.48690,85,1995-,SOLRAD,NOAA,"Site location pre Oct 28 2014 (38.97673, -77.48379)",https://gml.noaa.gov/grad/solrad/ste.html,Freely,G;B;D
Tallahassee,TLH,Florida,USA,30.39675,-84.32955,18,1995-2002,SOLRAD,NOAA,,https://gml.noaa.gov/grad/solrad/tlh.html,Freely,G;B;D
Portland,PT,Oregon,USA,45.51,-122.69,70,2004-,SRML,University of Oregon,5-min data between 2004 and 2011.,http://solardata.uoregon.edu/PortlandPV.html,Freely,RSR
Burns,BU,Oregon,USA,43.52,-119.02,1265,1994-,SRML,University of Oregon,5 min data from 1994 to 2011.,http://solardata.uoregon.edu/Burns.html,Freely,G;B;D
Expand Down

0 comments on commit 8cdbe4b

Please sign in to comment.