def setup_class(cls):
        TestBase.setup_class()

        cls.ctx, cls.expt, cls.protocol = cls.make_experiment_fixture()

        print("Importing example field data: {}".format(EXAMPLE_FIELD_DATA_CSV))
        import_csv(cls.ctx,
                   container_uri=str(cls.expt.getURI().toString()),
                   protocol_uri=str(cls.protocol.getURI().toString()),
                   files=[EXAMPLE_FIELD_DATA_CSV])
    def should_use_existing_sources(self):
        expt2 = self.ctx.insertProject("project2","project2",DateTime()).insertExperiment("purpose", DateTime())
        protocol2 = self.ctx.insertProtocol("protocol", "description")

        import_csv(self.ctx,
                   container_uri=expt2.getURI().toString(),
                   protocol_uri=protocol2.getURI().toString(),
                   files=[EXAMPLE_FIELD_DATA_CSV])

        expected_source_names = np.unique(self.df.Site)

        sources = self.ctx.getTopLevelSources()

        assert_equals(len(expected_source_names), len(list(iterable(sources))))
    def should_use_existing_site_epoch_when_present(self):
        expt2 = self.ctx.insertProject("project2","project2",DateTime()).insertExperiment("purpose", DateTime())
        protocol2 = self.ctx.insertProtocol("protocol", "description")

        import_csv(self.ctx,
                   container_uri=expt2.getURI().toString(),
                   protocol_uri=protocol2.getURI().toString(),
                   files=[EXAMPLE_FIELD_DATA_CSV])

        import_csv(self.ctx,
                   container_uri=expt2.getURI().toString(),
                   protocol_uri=protocol2.getURI().toString(),
                   files=[EXAMPLE_FIELD_DATA_CSV])

        self.check_epoch_per_site(expt2)
    def import_wrapper(ctx,
                       container=None,
                       protocol=None,
                       files=None,
                       timezone=None,
                       header_rows=None,
                       date_column=None,
                       measurement_column=None,
                       **args):

        return import_csv(ctx,
                          container_uri=container,
                          protocol_uri=protocol,
                          files=files,
                          timezone=timezone,
                          csv_header_row=header_rows,
                          date_column=date_column,
                          first_measurement_column=measurement_column)
    def import_wrapper(ctx,
                       container=None,
                       protocol=None,
                       files=None,
                       timezone=None,
                       header_rows=None,
                       date_column=None,
                       measurement_column=None,
                       **args):

        return import_csv(ctx,
                          container_uri=container,
                          protocol_uri=protocol,
                          files=files,
                          timezone=timezone,
                          csv_header_row=header_rows,
                          date_column=date_column,
                          first_measurement_column=measurement_column)