Skip to content

Commit 64ea754

Browse files
Promote 6S factory. MET_FLAG attribute. Linting.
1 parent bc34f36 commit 64ea754

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

Config/sample_SEABIRD_pySAS.cfg

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
"fL1bqcSpecFilterEs": 5.0,
114114
"fL1bqcSpecFilterLi": 8.0,
115115
"fL1bqcSpecFilterLt": 3.0,
116-
"bL1bqcEnableQualityFlags": 0,
116+
"bL1bqcEnableQualityFlags": 1,
117117
"fL1bqcCloudFlag": 1.0,
118118
"fL1bqcSignificantEsFlag": 2.0,
119119
"fL1bqcDawnDuskFlag": 1.0,
@@ -148,9 +148,8 @@
148148
"seaBASSHeaderFileName": "sample_SEABIRD_pySAS.hdr",
149149
"bL2SaveSeaBASS": 1,
150150
"bL2WriteReport": 1,
151-
"bL1b_InterpPlotTimeInterp": 1,
152151
"bL1dDeglitch": 1,
153-
"bL2EnableQualityFlags": 0,
152+
"bL2EnableQualityFlags": 1,
154153
"bL2Prodoc3m": 1,
155154
"bL2Prodkd490": 0,
156155
"bL2Prodpic": 0,

Config/sample_SEABIRD_pySAS.hdr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"south_latitude": "",
3131
"east_longitude": "",
3232
"west_longitude": "",
33-
"comments": "! HyperInSPACE vers = 1.2.4\n! HyperInSPACE Config = sample_SEABIRD_pySAS.cfg\n! Rotator Home Angle = 0.0\n! Rotator Delay = 2.0\n! Pitch/Roll Filter = On\n! Max Pitch/Roll = 5.0\n! Rotator Min/Max Filter = On\n! Rotator Min = -126.0\n! Rotator Max = 42.0\n! Rel Azimuth Filter = On\n! Rel Azimuth Min = 90.0\n! Rel Azimuth Max = 135.0\n! Deglitch Filter = On\n! ES Dark Window = 11\n! ES Light Window = 5\n! ES Dark Sigma = 3.2\n! ES Light Sigma = 2.3\n! LI Dark Window = 11\n! LI Light Window = 5\n! LI Dark Sigma = 3.3\n! LI Light Sigma = 3.0\n! LT Dark Window = 11\n! LT Light Window = 13\n! LT Dark Sigma = 3.2\n! LT Light Sigma = 2.7\n! FRM Pathway = FRM_Class-based\n! Wavelength Interp Int = 3.3\n! Max Wind = 10.0\n! Min SZA = 20.0\n! Max SZA = 60.0\n! Spectral Filter = On\n! Filter Sigma Es = 5.0\n! Filter Sigma Li = 8.0\n! Filter Sigma Lt = 3.0\n! Meteorological Filter = Off\n! Cloud Flag = 1.0\n! Es Flag = 2.0\n! Dawn/Dusk Flag = 1.0\n! Rain/Humidity Flag = 1.095\n! Ensemble Interval = 300\n! Percent Lt Filter = On\n! Percent Light = 10.0\n! Remove Negatives = On",
33+
"comments": "! HyperInSPACE vers = 1.2.4\n! HyperInSPACE Config = sample_SEABIRD_pySAS.cfg\n! Rotator Home Angle = 0.0\n! Rotator Delay = 2.0\n! Pitch/Roll Filter = On\n! Max Pitch/Roll = 5.0\n! Rotator Min/Max Filter = On\n! Rotator Min = -126.0\n! Rotator Max = 42.0\n! Rel Azimuth Filter = On\n! Rel Azimuth Min = 90.0\n! Rel Azimuth Max = 135.0\n! Deglitch Filter = On\n! ES Dark Window = 11\n! ES Light Window = 5\n! ES Dark Sigma = 3.2\n! ES Light Sigma = 2.3\n! LI Dark Window = 11\n! LI Light Window = 5\n! LI Dark Sigma = 3.3\n! LI Light Sigma = 3.0\n! LT Dark Window = 11\n! LT Light Window = 13\n! LT Dark Sigma = 3.2\n! LT Light Sigma = 2.7\n! FRM Pathway = FRM_Class-based\n! Wavelength Interp Int = 3.3\n! Max Wind = 10.0\n! Min SZA = 20.0\n! Max SZA = 60.0\n! Spectral Filter = On\n! Filter Sigma Es = 5.0\n! Filter Sigma Li = 8.0\n! Filter Sigma Lt = 3.0\n! Meteorological Filter = On\n! Cloud Flag = 1.0\n! Es Flag = 2.0\n! Dawn/Dusk Flag = 1.0\n! Rain/Humidity Flag = 1.095\n! Ensemble Interval = 300\n! Percent Lt Filter = On\n! Percent Light = 10.0\n! Remove Negatives = On",
3434
"other_comments": "!\n! COMMENTS\n!\n! FRM4SOC-2 Field InterComparison Experiment (FICE)\n! July 11 - 21, 2022\n! Acqua Alta Oceanographic Tower (AAOT), CNR-ISMAR\n!\n! Ancillary data from: % https://www.comune.venezia.it/content/3-piattaforma-ISMAR-CNR\n! and field notes. relAz refers to target relative azimuth in pySAS.\n!\n! Home",
3535
"missing": -9999,
3636
"delimiter": "comma",

Source/ProcessL1b_FactoryCal.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ def processL1b_SeaBird(node, calibrationMap):
264264
node.attributes["SATPYR_UNITS"] = pyrUnits
265265

266266
# Calculate 6S model
267+
print('Running Py6S')
268+
267269
sensortype = "ES"
268270
# Irradiance direct and diffuse ratio
269271
res_py6s = ProcessL1b_FRMCal.get_direct_irradiance_ratio(node, sensortype)

Source/ProcessL1bqc.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
1+
''' Process L1B to L1BQC '''
22
import numpy as np
33
import scipy as sp
4-
import datetime as datetime
54

65
from Source.MainConfig import MainConfig
76
from Source.Utilities import Utilities
@@ -120,8 +119,8 @@ def ltQuality(sasGroup):
120119

121120
badTimes = np.unique(badTimes)
122121
# Duplicate each element to a list of two elements in a list
123-
''' BUG: This is not optimal as it creates one badTimes record for each bad
124-
timestamp, rather than span of timestamps from badtimes[i][0] to badtimes[i][1]'''
122+
# BUG: This is not optimal as it creates one badTimes record for each bad
123+
# timestamp, rather than span of timestamps from badtimes[i][0] to badtimes[i][1]
125124
badTimes = np.rot90(np.matlib.repmat(badTimes,2,1), 3)
126125
msg = f'{len(np.unique(badTimes))/len(ltDatetime)*100:.1f}% of spectra flagged'
127126
print(msg)
@@ -191,7 +190,6 @@ def metQualityCheck(refGroup, sasGroup, py6sGroup, ancGroup):
191190
if li750[indx]/es750[indx] >= cloudFLAG:
192191
badTimes.append(dateTime)
193192
flags2[indx] = True
194-
195193

196194
# Flag for significant es
197195
# Wernand 2002
@@ -208,7 +206,7 @@ def metQualityCheck(refGroup, sasGroup, py6sGroup, ancGroup):
208206

209207
# Flag spectra affected by rainfall and high humidity
210208
# Wernand 2002 (940/370), Garaba et al. 2012 also uses Es(940/370), presumably 720 was developed by Wang...???
211-
''' Follow up on the source of this flag'''
209+
# NOTE: Follow up on the source of this flag
212210
if es720[indx]/es370[indx] < humidityFlag:
213211
badTimes.append(dateTime)
214212
flags5[indx] = True
@@ -218,7 +216,7 @@ def metQualityCheck(refGroup, sasGroup, py6sGroup, ancGroup):
218216
msg = f'{len(np.unique(badTimes))/len(esTime)*100:.1f}% of spectra flagged (not filtered)'
219217
print(msg)
220218
Utilities.writeLogFile(msg)
221-
219+
222220
# Restore timestamps to columns (since it's not going to filterData, where it otherwise happens)
223221
esData.datasetToColumns()
224222
liData.datasetToColumns()
@@ -719,6 +717,7 @@ def processL1bqc(node):
719717
gp.attributes["HUMIDITY_UNITS"] = "percent"
720718
gp.attributes["LATITUDE_UNITS"] = "dec. deg. N"
721719
gp.attributes["LONGITUDE_UNITS"] = "dec. deg. E"
720+
gp.attributes["MET_FLAGS"] = "1: 6S Cloud, 2: Ruddick Cloud, 3: Es, 4: Dark,s 5: Rain"
722721
gp.attributes["PITCH_UNITS"] = "degrees"
723722
gp.attributes["POINTING_UNITS"] = "degrees"
724723
gp.attributes["REL_AZ_UNITS"] = "degrees"

Source/ProcessL2.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,7 +2035,6 @@ def stationsEnsemblesReflectance(node, root, station=None):
20352035
rootCopy.getGroup('PY6S_MODEL').copy(root.getGroup('PY6S_MODEL'))
20362036
break
20372037

2038-
20392038
if ConfigFile.settings['SensorType'].lower() == 'seabird':
20402039
rootCopy.addGroup("ES_DARK_L1AQC")
20412040
rootCopy.addGroup("ES_LIGHT_L1AQC")
@@ -2112,17 +2111,17 @@ def stationsEnsemblesReflectance(node, root, station=None):
21122111
for index, stn in enumerate(stations):
21132112
# print(f'index: {index}, station: {station}, datetime: {dateTime[index]}')
21142113
# if np.isnan(station) and start == False:
2115-
if (stn != station) and (start == False):
2114+
if (stn != station) and (start is False):
21162115
start = dateTime[index]
21172116
# if not np.isnan(station) and not (start == False) and (stop == False):
2118-
if not (stn!=station) and not (start == False) and (stop == False):
2117+
if not (stn!=station) and (start is not False) and (stop is False):
21192118
stop = dateTime[index-1]
21202119
badTimes.append([start, stop])
21212120
start = False
21222121
stop = False
21232122
# End of file, no active station
21242123
# if np.isnan(station) and not (start == False) and (index == len(stations)-1):
2125-
if (stn != station) and not (start == False) and (index == len(stations)-1):
2124+
if (stn != station) and not (start is False) and (index == len(stations)-1):
21262125
stop = dateTime[index]
21272126
badTimes.append([start, stop])
21282127

0 commit comments

Comments
 (0)