Go to the documentation of this file.
4 Utility functions for determining directories for each sensor.
12 Read list of sensor definitions from file
16 keys = [
'sensor',
'instrument',
'platform',
'dir',
'subdir']
19 filename = os.path.join(os.getenv(
'OCDATAROOT'),
20 'common',
'SensorInfo.txt')
21 with open(filename)
as infile:
24 if (len(line) > 0)
and (
not line.startswith(
"#")):
25 values = line.rsplit()
26 SensorList.append(dict(zip(keys, values)))
27 except Exception
as e:
33 Get sensor defs from unique sensor name
36 if len(SensorList) == 0:
39 return next(d
for d
in SensorList
if d[
'sensor'].lower() == name.lower())
46 Get sensor defs given the instrument and platform
49 if len(SensorList) == 0:
52 return next(d
for d
in SensorList
if
53 (d[
'instrument'].lower() == inst.lower()) &
54 (d[
'platform'].lower() == plat.lower()))
61 Get sensor defs given any useful information
64 if len(SensorList) == 0:
67 return next(d
for d
in SensorList
if
68 name.lower()
in (d[
'sensor'].lower(),
69 d[
'platform'].lower(),
72 d[
'instrument'].lower()))
80 if __name__ ==
'__main__':
81 if len(SensorList) == 0:
84 namelist = [
'modisa',
'seawifs',
'bogus']
85 for sensor
in namelist:
88 print(
"\nby inst/plat:")
89 instlist = [
'modis',
'VIIRS',
'modis',
'bogus',
'Aquarius']
90 platlist = [
'Terra',
'JPSS-1',
'bogus',
'Aqua',
'SAC-D']
91 for inst, plat
in zip(instlist, platlist):
94 print(
"\nby any name:")
95 namelist = [
'seawifs',
'aquarius',
'modisa',
'modist',
'viirsn',
'viirsj1',
'aqua',
'terra',
'npp',
'j1',
98 print(name,
':\t',
by_desc(name))
def load_sensorlist(filename=None)
def by_instplat(inst, plat)