Move str repr onto builder

Description

Also adds representation methods. These don't handle large arrays as attributes well right now because pint just prints everything. In a follow up issue/MR, I would suggest:

  1. make each attribute collapsed by default
  2. PR into pint, making it behave more like xarray i.e. not showing every value unless the user asks for that

If you want to see the yuck behaviour with large arrays, code below

import numpy as np
values = ValuesBounded.from_build_args(
    values=Q(np.arange(1000), "m"),
    value_last_bound=Q([0], "m"),
)
time = TimeAxis.from_build_args(
    values=Q(np.arange(1000, 2000), "yr"),
    value_last_bound=Q([2050], "yr"),
)

inst = Timeseries.from_build_args(
    name="height",
    values=values,
    time=time,
    spline=Q(1, "dimensionless"),
)

inst

Checklist

Please confirm that this pull request has done the following:

  • Tests added (#69 (closed))
  • Documentation added (where applicable)
  • Changelog item added to changelog/
Edited by Zebedee Nicholls

Merge request reports

Loading