def construct_from_jdict(cls, jdict):
        if not jdict:
            return None

        org = jdict.get('org')
        group = jdict.get('group')
        loc = jdict.get('loc')
        topic = jdict.get('topic')

        device = jdict.get('device')
        parameters = jdict.get('parameters')
        duration = jdict.get('duration')
        checkpoint = jdict.get('checkpoint')

        agency_code = jdict.get('agency-code')
        site_code = jdict.get('site-code')
        pocs = jdict.get('pocs')

        upload_start = LocalizedDatetime.construct_from_jdict(
            jdict.get('upload-start'))
        upload_end = LocalizedDatetime.construct_from_jdict(
            jdict.get('upload-end'))

        return MappingTask(org, group, loc, topic, device, parameters,
                           duration, checkpoint, agency_code, site_code, pocs,
                           upload_start, upload_end)
    def construct_from_jdict(cls, jdict):
        if not jdict:
            return None

        rec = LocalizedDatetime.construct_from_jdict(jdict.get('rec'))

        p_a = jdict.get('pA')

        return NDIRPressureDatum(rec, p_a)
    def construct_from_jdict(cls, jdict):
        if not jdict:
            return None

        rec = LocalizedDatetime.construct_from_jdict(jdict.get('rec'))

        pile_ref = jdict.get('pile-ref')
        pile_act = jdict.get('pile-act')
        thermistor = jdict.get('therm')

        return NDIRMeasureVoltageDatum(rec, pile_ref, pile_act, thermistor)
Exemple #4
0
    def construct_from_jdict(cls, jdict):
        if not jdict:
            return None

        client_id = jdict.get('client-id')
        path = jdict.get('path')
        earliest_publication = LocalizedDatetime.construct_from_jdict(
            jdict.get('earliest-pub'))

        client_id = DeviceTopic(client_id, path, earliest_publication)

        return client_id
Exemple #5
0
    def construct_from_message_jdict(cls, jdict):
        if not jdict:
            return None

        client_id = jdict.get('device')
        path = jdict.get('topic')
        earliest_publication = LocalizedDatetime.construct_from_jdict(
            jdict.get('date'))

        client_id = DeviceTopic(client_id, path, earliest_publication)

        return client_id
Exemple #6
0
    def construct_from_jdict(cls, jdict):
        if not jdict:
            return None

        source = jdict.get('src')

        rec = LocalizedDatetime.construct_from_jdict(jdict.get('rec'))

        pm1 = jdict.get('pm1')
        pm2p5 = jdict.get('pm2p5')
        pm4 = jdict.get('pm4')
        pm10 = jdict.get('pm10')

        counts = SPSDatumCounts.construct_from_jdict(jdict.get('counts'))
        tps = jdict.get('tps')

        return SPSDatum(source, rec, pm1, pm2p5, pm4, pm10, counts, tps)
Exemple #7
0
    def construct_from_jdict(cls, jdict):
        if not jdict:
            return None

        source = jdict.get('src')

        rec = LocalizedDatetime.construct_from_jdict(jdict.get('rec'))

        period = jdict.get('per')

        pm1 = jdict.get('pm1')
        pm2p5 = jdict.get('pm2p5')
        pm10 = jdict.get('pm10')

        bins = jdict.get('bin')

        if bins is None:
            print("OPCDatum incomplete: %s" % jdict, file=sys.stderr)
            sys.stderr.flush()

            return None

        bin_1_mtof = jdict.get('mtf1')
        bin_3_mtof = jdict.get('mtf3')
        bin_5_mtof = jdict.get('mtf5')
        bin_7_mtof = jdict.get('mtf7')

        sfr = jdict.get('sfr')

        sht = SHTDatum.construct_from_jdict(jdict.get('sht'))

        return OPCDatum(source,
                        rec,
                        pm1,
                        pm2p5,
                        pm10,
                        period,
                        bins,
                        bin_1_mtof,
                        bin_3_mtof,
                        bin_5_mtof,
                        bin_7_mtof,
                        sfr=sfr,
                        sht=sht)
Exemple #8
0
# --------------------------------------------------------------------------------------------------------------------

org = "south-coast-science-demo"
group = "brighton"
loc = 1
topic = "particulates"
device = "praxis-000401"
parameters = ("val.pm1", "val.pm2p5", "val.pm10")
duration = 1
checkpoint = "**:/01:00"

agency_code = "AAAAAAAAAA"
site_code = "123MM123456789"
pocs = {"88101": 2, "85101": 3}

upload_start = LocalizedDatetime.construct_from_jdict("2019-03-13T12:45:00Z")
upload_end = LocalizedDatetime.construct_from_jdict("2019-03-14T12:45:00Z")

task = MappingTask(org, group, loc, topic, device, parameters, duration, checkpoint,
                   agency_code, site_code, pocs, upload_start, upload_end)
print(task)
print("-")

for mapping in task.mappings():
    print(mapping)
print("-")

print(task.environment_path())
print(task.status_path())
print("-")
Exemple #9
0
    def aqcsv_rec(self, datum: PathDict):
        localised = LocalizedDatetime.construct_from_jdict(datum.node('rec'))
        timezone = self.timezone(datum)

        return AQCSVDatetime(localised.datetime, timezone.zone)