Skip to content

Commit

Permalink
Generalize to other instruments different from AVHRR
Browse files Browse the repository at this point in the history
Signed-off-by: Adam.Dybbroe <adam.dybbroe@smhi.se>
  • Loading branch information
adybbroe committed Jun 27, 2018
1 parent 9d0c204 commit 0828219
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
10 changes: 4 additions & 6 deletions trollsched/boundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def get_instrument_points(self, overpass, utctime,
if instrument == "olci":
sgeom = instrument_fun(scans_nb, scanpoints)
elif instrument == 'ascat':
sgeom = instrument_fun(scans_nb)
sgeom = instrument_fun(scans_nb, scanpoints)
else:
sgeom = instrument_fun(scans_nb, scanpoints,
scan_angle=scan_angle, frequency=frequency)
Expand Down Expand Up @@ -183,8 +183,8 @@ def __init__(self, overpass, frequency=100.0):
sides_lons, sides_lats = self.get_instrument_points(self.overpass,
overpass.risetime,
scans_nb,
np.array(
[0, 2047]),
#np.array([0, 2047]),
np.array([0, -1]),
frequency=frequency)

self.left_lons = sides_lons[::-1, 0]
Expand All @@ -193,9 +193,7 @@ def __init__(self, overpass, frequency=100.0):
self.right_lats = sides_lats[:, 1]

# compute bottom

# avhrr
maxval = 2048
maxval = self.overpass.number_of_fovs
rest = maxval % frequency
reduced = np.hstack(
[0, np.arange(rest / 2, maxval, frequency), maxval - 1])
Expand Down
18 changes: 15 additions & 3 deletions trollsched/satpass.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
# DRL still use the name JPSS-1 in the TLEs:
NOAA20_NAME = {'NOAA-20': 'JPSS-1'}

NUMBER_OF_FOVS = {'avhrr': 2048,
'ascat': 42,
'viirs': 3200}


class Mapper(object):

Expand Down Expand Up @@ -168,9 +172,17 @@ class Pass(SimplePass):
"""A pass: satellite, risetime, falltime, (orbital)
"""

def __init__(self, satellite, risetime, falltime, orb=None, uptime=None,
instrument=None, tle1=None, tle2=None, frequency=100):
def __init__(self, satellite, risetime, falltime, **kwargs):
SimplePass.__init__(self, satellite, risetime, falltime)

orb = kwargs.get('orb', None)
uptime = kwargs.get('uptime', None)
instrument = kwargs.get('instrument', None)
tle1 = kwargs.get('tle1', None)
tle2 = kwargs.get('tle2', None)
self.number_of_fovs = kwargs.get('number_of_fovs', NUMBER_OF_FOVS.get(instrument, 2048))
frequency = kwargs.get('frequency', int(self.number_of_fovs / 4))

self.uptime = uptime or (risetime + (falltime - risetime) / 2)
self.instrument = instrument
self.frequency = frequency
Expand Down Expand Up @@ -237,7 +249,7 @@ def area_coverage(self, area_of_interest):
area_boundary = area_of_interest.poly
except AttributeError:
area_boundary = AreaDefBoundary(area_of_interest,
frequency=500)
frequency=100)
area_boundary = area_boundary.contour_poly
inter = self.boundary.contour_poly.intersection(area_boundary)
if inter is None:
Expand Down

0 comments on commit 0828219

Please sign in to comment.