Skip to content

Commit

Permalink
early test of CHLA slope
Browse files Browse the repository at this point in the history
requires pandas for now - check whether that is ok on BATMAN
  • Loading branch information
cgrdn committed Aug 1, 2024
1 parent 71a1f9f commit 4d1b159
Show file tree
Hide file tree
Showing 3 changed files with 65,363 additions and 1 deletion.
18 changes: 17 additions & 1 deletion medsrtqc/qc/chla.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
class ChlaTest(QCOperation):

def run_impl(self):

# whether or not to use geo lookup table for slope - False until allowed by ADMT - CG August 1, 2024
GEO_SLOPE = False

self.profile['FLU1'].adjusted.mask = False
chla = self.profile['FLU1']
fluo = self.profile['FLU3']
Expand Down Expand Up @@ -102,9 +106,11 @@ def run_impl(self):

self.save_last_dark_chla(int(last_dark_chla))

slope = self.get_rt_slope() if GEO_SLOPE else 2

adjusted = Trace(
pres=adjusted.pres,
value=self.convert(dark_prime_chla, scale_chla)/2, # Roesler et al. 2017 factor of 2 global bias
value=self.convert(dark_prime_chla, scale_chla)/slope, # Roesler et al. 2017 factor of 2 global bias or LUT value
qc=adjusted.qc,
mtime=adjusted.mtime
)
Expand Down Expand Up @@ -223,3 +229,13 @@ def save_last_dark_chla(self, v, cycle=None):

with open(resource_path('last_dark_chla.csv'), 'a') as fid:
fid.write(f'{self.profile.wmo:d},{cycle:d},{v:d}\n')

def get_rt_slope(self):

lon = self.longitude
lat = self.latitude

import pandas as pd # I don't know if this will work on BATMAN
slope = pd.read_csv(resource_path('SLOPE_RT_2024.txt'), sep=' ')
index = ((slope.lon - lon)**2 + (slope.lat - lat)**2).idxmin()
return slope.loc[index].slope
Loading

0 comments on commit 4d1b159

Please sign in to comment.