Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-820

Simplify copying tables while adding columns

    Details

    • Type: Improvement
    • Status: Won't Fix
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: afw
    • Labels:
      None
    • Templates:
    • Story Points:
      4
    • Team:
      Data Release Production

      Description

      Currently, if I want to copy a table while adding a few columns (as specified by schema in the example) I need to do something like:

              cat = afwTable.SourceCatalog(schema)
              cat.table.defineCentroid(srcCat.table.getCentroidDefinition())
              cat.table.definePsfFlux(srcCat.table.getPsfFluxDefinition())
              # etc.
       
              scm = afwTable.SchemaMapper(srcCat.getSchema(), schema)
              for schEl in srcCat.getSchema():
                  scm.addMapping(schEl.getKey(), True)
       
              cat.extend(srcCat, True, scm)

      Please make this easier! For example

      • by adding a flag to the SchemaMapper constructor that automatically does the addMapping (should this be the default?)
      • by making it possible to copy all the slots (maybe this'll be the case when the new alias scheme is implemented?).

      Maybe we just need a new method:

      cat = srcCat.extend(schema)

      that does all the above steps.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jbosch Jim Bosch
                Reporter:
                rhl Robert Lupton
                Watchers:
                Jim Bosch, John Swinbank, Robert Lupton
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel