Exemplo n.º 1
0
    def obs_create(self, vol, name, obsid, start, first):
        # create the observation within the TIDAS volume
        tob = ttutils.find_obs(vol, "", name)
        obsprops = tds.Dictionary()
        obsprops.put_int64("obs_id", obsid)
        obsprops.put_int64("obs_telescope_id", 1234)
        obsprops.put_int64("obs_site_id", 5678)

        # Create the observation group
        obsgroup = tob.group_add("observation",
                                 tds.Group(tds.Schema(), obsprops, 0))
        del obsprops
        del obsgroup

        # create intervals
        ilist = self.intervals_init(start, 0)
        dist = [(y.first - x.first) for x, y in zip(ilist[:-1], ilist[1:])]
        dist.append(self.obstotalsamp - ilist[-1].first)

        intr = tob.intervals_add("chunks",
                                 tds.Intervals(tds.Dictionary(), len(ilist)))
        #print("rank {}: write intervals".format(self.comm.rank), flush=True)
        intr.write(ilist)
        del intr
        del tob

        # Create a TOD for this observation.
        tt.TODTidas.create(vol, "/{}".format(name), self.dquat,
                           self.obstotalsamp, self.meta_setup(), True)

        return
Exemplo n.º 2
0
def from_dict(meta):
    td = tds.Dictionary()
    for k, v in meta.items():
        if isinstance(v, float):
            td.put_float64(k, v)
        elif isinstance(v, int):
            td.put_int64(k, v)
        else:
            td.put_string(k, str(v))
    return td
Exemplo n.º 3
0
 def meta_setup(self):
     ret = tds.Dictionary()
     ret.put_string("string", "blahblahblah")
     ret.put_float64("double", -1.234567890123e9)
     ret.put_float32("float", -123456.0)
     ret.put_int8("int8", -1)
     ret.put_uint8("uint8", 1)
     ret.put_int16("int16", -10000)
     ret.put_uint16("uint16", 10000)
     ret.put_int32("int32", -1000000000)
     ret.put_uint32("uint32", 1000000000)
     ret.put_int64("int64", -100000000000)
     ret.put_uint64("uint64", 100000000000)
     return ttutils.to_dict(ret)
Exemplo n.º 4
0
        weekday, nday = calendar.monthrange(int(year), monthnum)
        for dy in range(1, nday + 1):

            daystart = datetime.datetime(int(year), monthnum, dy)
            daystartsec = (daystart - volstart).total_seconds() + volstartsec

            # Add a block for the day
            day = "{:02d}".format(dy)
            db = mb.block_add(day, tidas.Block())

            # Now we are going to add the data groups for this day.

            print("Writing data for {} {:02d}, {}".format(month, dy, year))

            wind = tidas.Group(wind_schema, tidas.Dictionary(), wind_daysamples)
            wind = db.group_add("wind", wind)

            thermal = tidas.Group(
                thermal_schema, tidas.Dictionary(), thermal_daysamples
            )
            thermal = db.group_add("thermal", thermal)

            precip = tidas.Group(precip_schema, tidas.Dictionary(), precip_daysamples)
            precip = db.group_add("precip", precip)

            # Write timestamps to all groups

            wind.write_times(
                0,
                np.linspace(