Skip to content

WindTurbine Data Classes

examples.wind_turbine.data_classes

Blade

Bases: DomainModel

This represents the reading version of blade.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the blade.

required
data_record

The data record of the blade node.

required
is_damaged

The is damaged field.

required
name

Name of the instance

required
sensor_positions

The sensor position field.

required
Source code in examples/wind_turbine/data_classes/_blade.py
class Blade(DomainModel):
    """This represents the reading version of blade.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the blade.
        data_record: The data record of the blade node.
        is_damaged: The is damaged field.
        name: Name of the instance
        sensor_positions: The sensor position field.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Blade", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, None] = None
    is_damaged: Optional[bool] = None
    name: Optional[str] = None
    sensor_positions: Optional[list[SensorPosition]] = Field(default=None, repr=False)

    @field_validator("sensor_positions", mode="before")
    @classmethod
    def parse_list(cls, value: Any, info: ValidationInfo) -> Any:
        if value is None:
            return None
        return [parse_single_connection(item, info.field_name) for item in value]

    def as_write(self) -> BladeWrite:
        """Convert this read version of blade to the writing version."""
        return BladeWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of blade to the writing version.

Source code in examples/wind_turbine/data_classes/_blade.py
def as_write(self) -> BladeWrite:
    """Convert this read version of blade to the writing version."""
    return BladeWrite.model_validate(as_write_args(self))

BladeGraphQL

Bases: GraphQLCore

This represents the reading version of blade, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the blade.

required
data_record

The data record of the blade node.

required
is_damaged

The is damaged field.

required
name

Name of the instance

required
sensor_positions

The sensor position field.

required
Source code in examples/wind_turbine/data_classes/_blade.py
class BladeGraphQL(GraphQLCore):
    """This represents the reading version of blade, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the blade.
        data_record: The data record of the blade node.
        is_damaged: The is damaged field.
        name: Name of the instance
        sensor_positions: The sensor position field.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Blade", "1")
    is_damaged: Optional[bool] = None
    name: Optional[str] = None
    sensor_positions: Optional[list[SensorPositionGraphQL]] = Field(default=None, repr=False)

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    @field_validator("sensor_positions", mode="before")
    def parse_graphql(cls, value: Any) -> Any:
        if not isinstance(value, dict):
            return value
        if "items" in value:
            return value["items"]
        return value

    def as_read(self) -> Blade:
        """Convert this GraphQL format of blade to the reading format."""
        return Blade.model_validate(as_read_args(self))

    def as_write(self) -> BladeWrite:
        """Convert this GraphQL format of blade to the writing format."""
        return BladeWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of blade to the reading format.

Source code in examples/wind_turbine/data_classes/_blade.py
def as_read(self) -> Blade:
    """Convert this GraphQL format of blade to the reading format."""
    return Blade.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of blade to the writing format.

Source code in examples/wind_turbine/data_classes/_blade.py
def as_write(self) -> BladeWrite:
    """Convert this GraphQL format of blade to the writing format."""
    return BladeWrite.model_validate(as_write_args(self))

BladeList

Bases: DomainModelList[Blade]

List of blades in the read version.

Source code in examples/wind_turbine/data_classes/_blade.py
class BladeList(DomainModelList[Blade]):
    """List of blades in the read version."""

    _INSTANCE = Blade

    def as_write(self) -> BladeWriteList:
        """Convert these read versions of blade to the writing versions."""
        return BladeWriteList([node.as_write() for node in self.data])

    @property
    def sensor_positions(self) -> SensorPositionList:
        from ._sensor_position import SensorPosition, SensorPositionList

        return SensorPositionList(
            [item for items in self.data for item in items.sensor_positions or [] if isinstance(item, SensorPosition)]
        )

as_write()

Convert these read versions of blade to the writing versions.

Source code in examples/wind_turbine/data_classes/_blade.py
def as_write(self) -> BladeWriteList:
    """Convert these read versions of blade to the writing versions."""
    return BladeWriteList([node.as_write() for node in self.data])

BladeWrite

Bases: DomainModelWrite

This represents the writing version of blade.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the blade.

required
data_record

The data record of the blade node.

required
is_damaged

The is damaged field.

required
name

Name of the instance

required
Source code in examples/wind_turbine/data_classes/_blade.py
class BladeWrite(DomainModelWrite):
    """This represents the writing version of blade.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the blade.
        data_record: The data record of the blade node.
        is_damaged: The is damaged field.
        name: Name of the instance
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "is_damaged",
        "name",
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Blade", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    is_damaged: Optional[bool] = None
    name: Optional[str] = None

BladeWriteList

Bases: DomainModelWriteList[BladeWrite]

List of blades in the writing version.

Source code in examples/wind_turbine/data_classes/_blade.py
class BladeWriteList(DomainModelWriteList[BladeWrite]):
    """List of blades in the writing version."""

    _INSTANCE = BladeWrite

DataSheet

Bases: DomainModel

This represents the reading version of data sheet.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the data sheet.

required
data_record

The data record of the data sheet node.

required
description

Description of the instance

required
directory

Contains the path elements from the source (if the source system has a file system hierarchy or similar.)

required
is_uploaded

Specifies if the file content has been uploaded to Cognite Data Fusion or not.

required
mime_type

The MIME type of the file.

required
name

Name of the instance

required
uploaded_time

The time the file upload completed.

required
Source code in examples/wind_turbine/data_classes/_data_sheet.py
class DataSheet(DomainModel):
    """This represents the reading version of data sheet.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the data sheet.
        data_record: The data record of the data sheet node.
        description: Description of the instance
        directory: Contains the path elements from the source (if the source system has a file system hierarchy or
            similar.)
        is_uploaded: Specifies if the file content has been uploaded to Cognite Data Fusion or not.
        mime_type: The MIME type of the file.
        name: Name of the instance
        uploaded_time: The time the file upload completed.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "DataSheet", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, None] = None
    description: Optional[str] = None
    directory: Optional[str] = None
    is_uploaded: Optional[bool] = Field(None, alias="isUploaded")
    mime_type: Optional[str] = Field(None, alias="mimeType")
    name: Optional[str] = None
    uploaded_time: Optional[datetime.datetime] = Field(None, alias="uploadedTime")

    def as_write(self) -> DataSheetWrite:
        """Convert this read version of data sheet to the writing version."""
        return DataSheetWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of data sheet to the writing version.

Source code in examples/wind_turbine/data_classes/_data_sheet.py
def as_write(self) -> DataSheetWrite:
    """Convert this read version of data sheet to the writing version."""
    return DataSheetWrite.model_validate(as_write_args(self))

DataSheetGraphQL

Bases: GraphQLCore

This represents the reading version of data sheet, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the data sheet.

required
data_record

The data record of the data sheet node.

required
description

Description of the instance

required
directory

Contains the path elements from the source (if the source system has a file system hierarchy or similar.)

required
is_uploaded

Specifies if the file content has been uploaded to Cognite Data Fusion or not.

required
mime_type

The MIME type of the file.

required
name

Name of the instance

required
uploaded_time

The time the file upload completed.

required
Source code in examples/wind_turbine/data_classes/_data_sheet.py
class DataSheetGraphQL(GraphQLCore):
    """This represents the reading version of data sheet, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the data sheet.
        data_record: The data record of the data sheet node.
        description: Description of the instance
        directory: Contains the path elements from the source (if the source system has a file system hierarchy or
            similar.)
        is_uploaded: Specifies if the file content has been uploaded to Cognite Data Fusion or not.
        mime_type: The MIME type of the file.
        name: Name of the instance
        uploaded_time: The time the file upload completed.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "DataSheet", "1")
    description: Optional[str] = None
    directory: Optional[str] = None
    is_uploaded: Optional[bool] = Field(None, alias="isUploaded")
    mime_type: Optional[str] = Field(None, alias="mimeType")
    name: Optional[str] = None
    uploaded_time: Optional[datetime.datetime] = Field(None, alias="uploadedTime")

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    def as_read(self) -> DataSheet:
        """Convert this GraphQL format of data sheet to the reading format."""
        return DataSheet.model_validate(as_read_args(self))

    def as_write(self) -> DataSheetWrite:
        """Convert this GraphQL format of data sheet to the writing format."""
        return DataSheetWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of data sheet to the reading format.

Source code in examples/wind_turbine/data_classes/_data_sheet.py
def as_read(self) -> DataSheet:
    """Convert this GraphQL format of data sheet to the reading format."""
    return DataSheet.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of data sheet to the writing format.

Source code in examples/wind_turbine/data_classes/_data_sheet.py
def as_write(self) -> DataSheetWrite:
    """Convert this GraphQL format of data sheet to the writing format."""
    return DataSheetWrite.model_validate(as_write_args(self))

DataSheetList

Bases: DomainModelList[DataSheet]

List of data sheets in the read version.

Source code in examples/wind_turbine/data_classes/_data_sheet.py
class DataSheetList(DomainModelList[DataSheet]):
    """List of data sheets in the read version."""

    _INSTANCE = DataSheet

    def as_write(self) -> DataSheetWriteList:
        """Convert these read versions of data sheet to the writing versions."""
        return DataSheetWriteList([node.as_write() for node in self.data])

as_write()

Convert these read versions of data sheet to the writing versions.

Source code in examples/wind_turbine/data_classes/_data_sheet.py
def as_write(self) -> DataSheetWriteList:
    """Convert these read versions of data sheet to the writing versions."""
    return DataSheetWriteList([node.as_write() for node in self.data])

DataSheetWrite

Bases: DomainModelWrite

This represents the writing version of data sheet.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the data sheet.

required
data_record

The data record of the data sheet node.

required
description

Description of the instance

required
directory

Contains the path elements from the source (if the source system has a file system hierarchy or similar.)

required
mime_type

The MIME type of the file.

required
name

Name of the instance

required
Source code in examples/wind_turbine/data_classes/_data_sheet.py
class DataSheetWrite(DomainModelWrite):
    """This represents the writing version of data sheet.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the data sheet.
        data_record: The data record of the data sheet node.
        description: Description of the instance
        directory: Contains the path elements from the source (if the source system has a file system hierarchy or
            similar.)
        mime_type: The MIME type of the file.
        name: Name of the instance
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "description",
        "directory",
        "mime_type",
        "name",
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "DataSheet", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    description: Optional[str] = None
    directory: Optional[str] = None
    mime_type: Optional[str] = Field(None, alias="mimeType")
    name: Optional[str] = None

DataSheetWriteList

Bases: DomainModelWriteList[DataSheetWrite]

List of data sheets in the writing version.

Source code in examples/wind_turbine/data_classes/_data_sheet.py
class DataSheetWriteList(DomainModelWriteList[DataSheetWrite]):
    """List of data sheets in the writing version."""

    _INSTANCE = DataSheetWrite

Distance

Bases: DomainRelation

This represents the reading version of distance.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the distance.

required
data_record

The data record of the distance edge.

required
end_node

The end node of this edge.

required
distance

The distance field.

required
Source code in examples/wind_turbine/data_classes/_distance.py
class Distance(DomainRelation):
    """This represents the reading version of distance.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the distance.
        data_record: The data record of the distance edge.
        end_node: The end node of this edge.
        distance: The distance field.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Distance", "1")
    space: str = DEFAULT_INSTANCE_SPACE
    end_node: Union[Metmast, WindTurbine, str, dm.NodeId] = Field(alias="endNode")
    distance: Optional[float] = None

    def as_write(self) -> DistanceWrite:
        """Convert this read version of distance to the writing version."""
        return DistanceWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of distance to the writing version.

Source code in examples/wind_turbine/data_classes/_distance.py
def as_write(self) -> DistanceWrite:
    """Convert this read version of distance to the writing version."""
    return DistanceWrite.model_validate(as_write_args(self))

DistanceGraphQL

Bases: GraphQLCore

This represents the reading version of distance, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the distance.

required
data_record

The data record of the distance node.

required
end_node

The end node of this edge.

required
distance

The distance field.

required
Source code in examples/wind_turbine/data_classes/_distance.py
class DistanceGraphQL(GraphQLCore):
    """This represents the reading version of distance, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the distance.
        data_record: The data record of the distance node.
        end_node: The end node of this edge.
        distance: The distance field.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Distance", "1")
    end_node: Union[MetmastGraphQL, WindTurbineGraphQL, None] = Field(None, alias="endNode")
    distance: Optional[float] = None

    def as_read(self) -> Distance:
        """Convert this GraphQL format of distance to the reading format."""
        return Distance.model_validate(as_read_args(self))

    def as_write(self) -> DistanceWrite:
        """Convert this GraphQL format of distance to the writing format."""
        return DistanceWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of distance to the reading format.

Source code in examples/wind_turbine/data_classes/_distance.py
def as_read(self) -> Distance:
    """Convert this GraphQL format of distance to the reading format."""
    return Distance.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of distance to the writing format.

Source code in examples/wind_turbine/data_classes/_distance.py
def as_write(self) -> DistanceWrite:
    """Convert this GraphQL format of distance to the writing format."""
    return DistanceWrite.model_validate(as_write_args(self))

DistanceList

Bases: DomainRelationList[Distance]

List of distances in the reading version.

Source code in examples/wind_turbine/data_classes/_distance.py
class DistanceList(DomainRelationList[Distance]):
    """List of distances in the reading version."""

    _INSTANCE = Distance

    def as_write(self) -> DistanceWriteList:
        """Convert this read version of distance list to the writing version."""
        return DistanceWriteList([edge.as_write() for edge in self])

as_write()

Convert this read version of distance list to the writing version.

Source code in examples/wind_turbine/data_classes/_distance.py
def as_write(self) -> DistanceWriteList:
    """Convert this read version of distance list to the writing version."""
    return DistanceWriteList([edge.as_write() for edge in self])

DistanceWrite

Bases: DomainRelationWrite

This represents the writing version of distance.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the distance.

required
data_record

The data record of the distance edge.

required
end_node

The end node of this edge.

required
distance

The distance field.

required
Source code in examples/wind_turbine/data_classes/_distance.py
class DistanceWrite(DomainRelationWrite):
    """This represents the writing version of distance.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the distance.
        data_record: The data record of the distance edge.
        end_node: The end node of this edge.
        distance: The distance field.
    """

    _container_fields: ClassVar[tuple[str, ...]] = ("distance",)
    _validate_end_node = _validate_end_node

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Distance", "1")
    end_node: Union[MetmastWrite, WindTurbineWrite, str, dm.NodeId] = Field(alias="endNode")
    distance: Optional[float] = None

DistanceWriteList

Bases: DomainRelationWriteList[DistanceWrite]

List of distances in the writing version.

Source code in examples/wind_turbine/data_classes/_distance.py
class DistanceWriteList(DomainRelationWriteList[DistanceWrite]):
    """List of distances in the writing version."""

    _INSTANCE = DistanceWrite

Gearbox

Bases: DomainModel

This represents the reading version of gearbox.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the gearbox.

required
data_record

The data record of the gearbox node.

required
displacement_x

The displacement x field.

required
displacement_y

The displacement y field.

required
displacement_z

The displacement z field.

required
nacelle

The nacelle field.

required
Source code in examples/wind_turbine/data_classes/_gearbox.py
class Gearbox(DomainModel):
    """This represents the reading version of gearbox.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the gearbox.
        data_record: The data record of the gearbox node.
        displacement_x: The displacement x field.
        displacement_y: The displacement y field.
        displacement_z: The displacement z field.
        nacelle: The nacelle field.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Gearbox", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, None] = None
    displacement_x: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    displacement_y: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    displacement_z: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    nacelle: Optional[Nacelle] = Field(default=None, repr=False)

    @field_validator("displacement_x", "displacement_y", "displacement_z", "nacelle", mode="before")
    @classmethod
    def parse_single(cls, value: Any, info: ValidationInfo) -> Any:
        return parse_single_connection(value, info.field_name)

    def as_write(self) -> GearboxWrite:
        """Convert this read version of gearbox to the writing version."""
        return GearboxWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of gearbox to the writing version.

Source code in examples/wind_turbine/data_classes/_gearbox.py
def as_write(self) -> GearboxWrite:
    """Convert this read version of gearbox to the writing version."""
    return GearboxWrite.model_validate(as_write_args(self))

GearboxGraphQL

Bases: GraphQLCore

This represents the reading version of gearbox, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the gearbox.

required
data_record

The data record of the gearbox node.

required
displacement_x

The displacement x field.

required
displacement_y

The displacement y field.

required
displacement_z

The displacement z field.

required
nacelle

The nacelle field.

required
Source code in examples/wind_turbine/data_classes/_gearbox.py
class GearboxGraphQL(GraphQLCore):
    """This represents the reading version of gearbox, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the gearbox.
        data_record: The data record of the gearbox node.
        displacement_x: The displacement x field.
        displacement_y: The displacement y field.
        displacement_z: The displacement z field.
        nacelle: The nacelle field.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Gearbox", "1")
    displacement_x: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    displacement_y: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    displacement_z: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    nacelle: Optional[NacelleGraphQL] = Field(default=None, repr=False)

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    @field_validator("displacement_x", "displacement_y", "displacement_z", "nacelle", mode="before")
    def parse_graphql(cls, value: Any) -> Any:
        if not isinstance(value, dict):
            return value
        if "items" in value:
            return value["items"]
        return value

    def as_read(self) -> Gearbox:
        """Convert this GraphQL format of gearbox to the reading format."""
        return Gearbox.model_validate(as_read_args(self))

    def as_write(self) -> GearboxWrite:
        """Convert this GraphQL format of gearbox to the writing format."""
        return GearboxWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of gearbox to the reading format.

Source code in examples/wind_turbine/data_classes/_gearbox.py
def as_read(self) -> Gearbox:
    """Convert this GraphQL format of gearbox to the reading format."""
    return Gearbox.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of gearbox to the writing format.

Source code in examples/wind_turbine/data_classes/_gearbox.py
def as_write(self) -> GearboxWrite:
    """Convert this GraphQL format of gearbox to the writing format."""
    return GearboxWrite.model_validate(as_write_args(self))

GearboxList

Bases: DomainModelList[Gearbox]

List of gearboxes in the read version.

Source code in examples/wind_turbine/data_classes/_gearbox.py
class GearboxList(DomainModelList[Gearbox]):
    """List of gearboxes in the read version."""

    _INSTANCE = Gearbox

    def as_write(self) -> GearboxWriteList:
        """Convert these read versions of gearbox to the writing versions."""
        return GearboxWriteList([node.as_write() for node in self.data])

    @property
    def displacement_x(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.displacement_x for item in self.data if isinstance(item.displacement_x, SensorTimeSeries)]
        )

    @property
    def displacement_y(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.displacement_y for item in self.data if isinstance(item.displacement_y, SensorTimeSeries)]
        )

    @property
    def displacement_z(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.displacement_z for item in self.data if isinstance(item.displacement_z, SensorTimeSeries)]
        )

    @property
    def nacelle(self) -> NacelleList:
        from ._nacelle import Nacelle, NacelleList

        return NacelleList([item.nacelle for item in self.data if isinstance(item.nacelle, Nacelle)])

as_write()

Convert these read versions of gearbox to the writing versions.

Source code in examples/wind_turbine/data_classes/_gearbox.py
def as_write(self) -> GearboxWriteList:
    """Convert these read versions of gearbox to the writing versions."""
    return GearboxWriteList([node.as_write() for node in self.data])

GearboxWrite

Bases: DomainModelWrite

This represents the writing version of gearbox.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the gearbox.

required
data_record

The data record of the gearbox node.

required
displacement_x

The displacement x field.

required
displacement_y

The displacement y field.

required
displacement_z

The displacement z field.

required
Source code in examples/wind_turbine/data_classes/_gearbox.py
class GearboxWrite(DomainModelWrite):
    """This represents the writing version of gearbox.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the gearbox.
        data_record: The data record of the gearbox node.
        displacement_x: The displacement x field.
        displacement_y: The displacement y field.
        displacement_z: The displacement z field.
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "displacement_x",
        "displacement_y",
        "displacement_z",
    )
    _direct_relations: ClassVar[tuple[str, ...]] = (
        "displacement_x",
        "displacement_y",
        "displacement_z",
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Gearbox", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    displacement_x: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    displacement_y: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    displacement_z: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)

    @field_validator("displacement_x", "displacement_y", "displacement_z", mode="before")
    def as_node_id(cls, value: Any) -> Any:
        if isinstance(value, dm.DirectRelationReference):
            return dm.NodeId(value.space, value.external_id)
        elif isinstance(value, tuple) and len(value) == 2 and all(isinstance(item, str) for item in value):
            return dm.NodeId(value[0], value[1])
        elif isinstance(value, list):
            return [cls.as_node_id(item) for item in value]
        return value

GearboxWriteList

Bases: DomainModelWriteList[GearboxWrite]

List of gearboxes in the writing version.

Source code in examples/wind_turbine/data_classes/_gearbox.py
class GearboxWriteList(DomainModelWriteList[GearboxWrite]):
    """List of gearboxes in the writing version."""

    _INSTANCE = GearboxWrite

    @property
    def displacement_x(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [item.displacement_x for item in self.data if isinstance(item.displacement_x, SensorTimeSeriesWrite)]
        )

    @property
    def displacement_y(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [item.displacement_y for item in self.data if isinstance(item.displacement_y, SensorTimeSeriesWrite)]
        )

    @property
    def displacement_z(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [item.displacement_z for item in self.data if isinstance(item.displacement_z, SensorTimeSeriesWrite)]
        )

GeneratingUnit

Bases: DomainModel

This represents the reading version of generating unit.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the generating unit.

required
data_record

The data record of the generating unit node.

required
capacity

The capacity field.

required
description

Description of the instance

required
name

Name of the instance

required
Source code in examples/wind_turbine/data_classes/_generating_unit.py
class GeneratingUnit(DomainModel):
    """This represents the reading version of generating unit.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the generating unit.
        data_record: The data record of the generating unit node.
        capacity: The capacity field.
        description: Description of the instance
        name: Name of the instance
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "GeneratingUnit", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, None] = None
    capacity: Optional[float] = None
    description: Optional[str] = None
    name: Optional[str] = None

    def as_write(self) -> GeneratingUnitWrite:
        """Convert this read version of generating unit to the writing version."""
        return GeneratingUnitWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of generating unit to the writing version.

Source code in examples/wind_turbine/data_classes/_generating_unit.py
def as_write(self) -> GeneratingUnitWrite:
    """Convert this read version of generating unit to the writing version."""
    return GeneratingUnitWrite.model_validate(as_write_args(self))

GeneratingUnitGraphQL

Bases: GraphQLCore

This represents the reading version of generating unit, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the generating unit.

required
data_record

The data record of the generating unit node.

required
capacity

The capacity field.

required
description

Description of the instance

required
name

Name of the instance

required
Source code in examples/wind_turbine/data_classes/_generating_unit.py
class GeneratingUnitGraphQL(GraphQLCore):
    """This represents the reading version of generating unit, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the generating unit.
        data_record: The data record of the generating unit node.
        capacity: The capacity field.
        description: Description of the instance
        name: Name of the instance
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "GeneratingUnit", "1")
    capacity: Optional[float] = None
    description: Optional[str] = None
    name: Optional[str] = None

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    def as_read(self) -> GeneratingUnit:
        """Convert this GraphQL format of generating unit to the reading format."""
        return GeneratingUnit.model_validate(as_read_args(self))

    def as_write(self) -> GeneratingUnitWrite:
        """Convert this GraphQL format of generating unit to the writing format."""
        return GeneratingUnitWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of generating unit to the reading format.

Source code in examples/wind_turbine/data_classes/_generating_unit.py
def as_read(self) -> GeneratingUnit:
    """Convert this GraphQL format of generating unit to the reading format."""
    return GeneratingUnit.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of generating unit to the writing format.

Source code in examples/wind_turbine/data_classes/_generating_unit.py
def as_write(self) -> GeneratingUnitWrite:
    """Convert this GraphQL format of generating unit to the writing format."""
    return GeneratingUnitWrite.model_validate(as_write_args(self))

GeneratingUnitList

Bases: DomainModelList[GeneratingUnit]

List of generating units in the read version.

Source code in examples/wind_turbine/data_classes/_generating_unit.py
class GeneratingUnitList(DomainModelList[GeneratingUnit]):
    """List of generating units in the read version."""

    _INSTANCE = GeneratingUnit

    def as_write(self) -> GeneratingUnitWriteList:
        """Convert these read versions of generating unit to the writing versions."""
        return GeneratingUnitWriteList([node.as_write() for node in self.data])

as_write()

Convert these read versions of generating unit to the writing versions.

Source code in examples/wind_turbine/data_classes/_generating_unit.py
def as_write(self) -> GeneratingUnitWriteList:
    """Convert these read versions of generating unit to the writing versions."""
    return GeneratingUnitWriteList([node.as_write() for node in self.data])

GeneratingUnitWrite

Bases: DomainModelWrite

This represents the writing version of generating unit.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the generating unit.

required
data_record

The data record of the generating unit node.

required
capacity

The capacity field.

required
description

Description of the instance

required
name

Name of the instance

required
Source code in examples/wind_turbine/data_classes/_generating_unit.py
class GeneratingUnitWrite(DomainModelWrite):
    """This represents the writing version of generating unit.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the generating unit.
        data_record: The data record of the generating unit node.
        capacity: The capacity field.
        description: Description of the instance
        name: Name of the instance
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "capacity",
        "description",
        "name",
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "GeneratingUnit", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    capacity: Optional[float] = None
    description: Optional[str] = None
    name: Optional[str] = None

GeneratingUnitWriteList

Bases: DomainModelWriteList[GeneratingUnitWrite]

List of generating units in the writing version.

Source code in examples/wind_turbine/data_classes/_generating_unit.py
class GeneratingUnitWriteList(DomainModelWriteList[GeneratingUnitWrite]):
    """List of generating units in the writing version."""

    _INSTANCE = GeneratingUnitWrite

Generator

Bases: DomainModel

This represents the reading version of generator.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the generator.

required
data_record

The data record of the generator node.

required
generator_speed_controller

The generator speed controller field.

required
generator_speed_controller_reference

The generator speed controller reference field.

required
nacelle

The nacelle field.

required
Source code in examples/wind_turbine/data_classes/_generator.py
class Generator(DomainModel):
    """This represents the reading version of generator.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the generator.
        data_record: The data record of the generator node.
        generator_speed_controller: The generator speed controller field.
        generator_speed_controller_reference: The generator speed controller reference field.
        nacelle: The nacelle field.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Generator", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, None] = None
    generator_speed_controller: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    generator_speed_controller_reference: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(
        default=None, repr=False
    )
    nacelle: Optional[Nacelle] = Field(default=None, repr=False)

    @field_validator("generator_speed_controller", "generator_speed_controller_reference", "nacelle", mode="before")
    @classmethod
    def parse_single(cls, value: Any, info: ValidationInfo) -> Any:
        return parse_single_connection(value, info.field_name)

    def as_write(self) -> GeneratorWrite:
        """Convert this read version of generator to the writing version."""
        return GeneratorWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of generator to the writing version.

Source code in examples/wind_turbine/data_classes/_generator.py
def as_write(self) -> GeneratorWrite:
    """Convert this read version of generator to the writing version."""
    return GeneratorWrite.model_validate(as_write_args(self))

GeneratorGraphQL

Bases: GraphQLCore

This represents the reading version of generator, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the generator.

required
data_record

The data record of the generator node.

required
generator_speed_controller

The generator speed controller field.

required
generator_speed_controller_reference

The generator speed controller reference field.

required
nacelle

The nacelle field.

required
Source code in examples/wind_turbine/data_classes/_generator.py
class GeneratorGraphQL(GraphQLCore):
    """This represents the reading version of generator, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the generator.
        data_record: The data record of the generator node.
        generator_speed_controller: The generator speed controller field.
        generator_speed_controller_reference: The generator speed controller reference field.
        nacelle: The nacelle field.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Generator", "1")
    generator_speed_controller: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    generator_speed_controller_reference: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    nacelle: Optional[NacelleGraphQL] = Field(default=None, repr=False)

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    @field_validator("generator_speed_controller", "generator_speed_controller_reference", "nacelle", mode="before")
    def parse_graphql(cls, value: Any) -> Any:
        if not isinstance(value, dict):
            return value
        if "items" in value:
            return value["items"]
        return value

    def as_read(self) -> Generator:
        """Convert this GraphQL format of generator to the reading format."""
        return Generator.model_validate(as_read_args(self))

    def as_write(self) -> GeneratorWrite:
        """Convert this GraphQL format of generator to the writing format."""
        return GeneratorWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of generator to the reading format.

Source code in examples/wind_turbine/data_classes/_generator.py
def as_read(self) -> Generator:
    """Convert this GraphQL format of generator to the reading format."""
    return Generator.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of generator to the writing format.

Source code in examples/wind_turbine/data_classes/_generator.py
def as_write(self) -> GeneratorWrite:
    """Convert this GraphQL format of generator to the writing format."""
    return GeneratorWrite.model_validate(as_write_args(self))

GeneratorList

Bases: DomainModelList[Generator]

List of generators in the read version.

Source code in examples/wind_turbine/data_classes/_generator.py
class GeneratorList(DomainModelList[Generator]):
    """List of generators in the read version."""

    _INSTANCE = Generator

    def as_write(self) -> GeneratorWriteList:
        """Convert these read versions of generator to the writing versions."""
        return GeneratorWriteList([node.as_write() for node in self.data])

    @property
    def generator_speed_controller(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [
                item.generator_speed_controller
                for item in self.data
                if isinstance(item.generator_speed_controller, SensorTimeSeries)
            ]
        )

    @property
    def generator_speed_controller_reference(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [
                item.generator_speed_controller_reference
                for item in self.data
                if isinstance(item.generator_speed_controller_reference, SensorTimeSeries)
            ]
        )

    @property
    def nacelle(self) -> NacelleList:
        from ._nacelle import Nacelle, NacelleList

        return NacelleList([item.nacelle for item in self.data if isinstance(item.nacelle, Nacelle)])

as_write()

Convert these read versions of generator to the writing versions.

Source code in examples/wind_turbine/data_classes/_generator.py
def as_write(self) -> GeneratorWriteList:
    """Convert these read versions of generator to the writing versions."""
    return GeneratorWriteList([node.as_write() for node in self.data])

GeneratorWrite

Bases: DomainModelWrite

This represents the writing version of generator.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the generator.

required
data_record

The data record of the generator node.

required
generator_speed_controller

The generator speed controller field.

required
generator_speed_controller_reference

The generator speed controller reference field.

required
Source code in examples/wind_turbine/data_classes/_generator.py
class GeneratorWrite(DomainModelWrite):
    """This represents the writing version of generator.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the generator.
        data_record: The data record of the generator node.
        generator_speed_controller: The generator speed controller field.
        generator_speed_controller_reference: The generator speed controller reference field.
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "generator_speed_controller",
        "generator_speed_controller_reference",
    )
    _direct_relations: ClassVar[tuple[str, ...]] = (
        "generator_speed_controller",
        "generator_speed_controller_reference",
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Generator", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    generator_speed_controller: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    generator_speed_controller_reference: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(
        default=None, repr=False
    )

    @field_validator("generator_speed_controller", "generator_speed_controller_reference", mode="before")
    def as_node_id(cls, value: Any) -> Any:
        if isinstance(value, dm.DirectRelationReference):
            return dm.NodeId(value.space, value.external_id)
        elif isinstance(value, tuple) and len(value) == 2 and all(isinstance(item, str) for item in value):
            return dm.NodeId(value[0], value[1])
        elif isinstance(value, list):
            return [cls.as_node_id(item) for item in value]
        return value

GeneratorWriteList

Bases: DomainModelWriteList[GeneratorWrite]

List of generators in the writing version.

Source code in examples/wind_turbine/data_classes/_generator.py
class GeneratorWriteList(DomainModelWriteList[GeneratorWrite]):
    """List of generators in the writing version."""

    _INSTANCE = GeneratorWrite

    @property
    def generator_speed_controller(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.generator_speed_controller
                for item in self.data
                if isinstance(item.generator_speed_controller, SensorTimeSeriesWrite)
            ]
        )

    @property
    def generator_speed_controller_reference(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.generator_speed_controller_reference
                for item in self.data
                if isinstance(item.generator_speed_controller_reference, SensorTimeSeriesWrite)
            ]
        )

HighSpeedShaft

Bases: DomainModel

This represents the reading version of high speed shaft.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the high speed shaft.

required
data_record

The data record of the high speed shaft node.

required
bending_moment_y

The bending moment y field.

required
bending_monent_x

The bending monent x field.

required
nacelle

The nacelle field.

required
torque

The torque field.

required
Source code in examples/wind_turbine/data_classes/_high_speed_shaft.py
class HighSpeedShaft(DomainModel):
    """This represents the reading version of high speed shaft.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the high speed shaft.
        data_record: The data record of the high speed shaft node.
        bending_moment_y: The bending moment y field.
        bending_monent_x: The bending monent x field.
        nacelle: The nacelle field.
        torque: The torque field.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "HighSpeedShaft", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, None] = None
    bending_moment_y: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    bending_monent_x: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    nacelle: Optional[Nacelle] = Field(default=None, repr=False)
    torque: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)

    @field_validator("bending_moment_y", "bending_monent_x", "nacelle", "torque", mode="before")
    @classmethod
    def parse_single(cls, value: Any, info: ValidationInfo) -> Any:
        return parse_single_connection(value, info.field_name)

    def as_write(self) -> HighSpeedShaftWrite:
        """Convert this read version of high speed shaft to the writing version."""
        return HighSpeedShaftWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of high speed shaft to the writing version.

Source code in examples/wind_turbine/data_classes/_high_speed_shaft.py
def as_write(self) -> HighSpeedShaftWrite:
    """Convert this read version of high speed shaft to the writing version."""
    return HighSpeedShaftWrite.model_validate(as_write_args(self))

HighSpeedShaftGraphQL

Bases: GraphQLCore

This represents the reading version of high speed shaft, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the high speed shaft.

required
data_record

The data record of the high speed shaft node.

required
bending_moment_y

The bending moment y field.

required
bending_monent_x

The bending monent x field.

required
nacelle

The nacelle field.

required
torque

The torque field.

required
Source code in examples/wind_turbine/data_classes/_high_speed_shaft.py
class HighSpeedShaftGraphQL(GraphQLCore):
    """This represents the reading version of high speed shaft, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the high speed shaft.
        data_record: The data record of the high speed shaft node.
        bending_moment_y: The bending moment y field.
        bending_monent_x: The bending monent x field.
        nacelle: The nacelle field.
        torque: The torque field.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "HighSpeedShaft", "1")
    bending_moment_y: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    bending_monent_x: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    nacelle: Optional[NacelleGraphQL] = Field(default=None, repr=False)
    torque: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    @field_validator("bending_moment_y", "bending_monent_x", "nacelle", "torque", mode="before")
    def parse_graphql(cls, value: Any) -> Any:
        if not isinstance(value, dict):
            return value
        if "items" in value:
            return value["items"]
        return value

    def as_read(self) -> HighSpeedShaft:
        """Convert this GraphQL format of high speed shaft to the reading format."""
        return HighSpeedShaft.model_validate(as_read_args(self))

    def as_write(self) -> HighSpeedShaftWrite:
        """Convert this GraphQL format of high speed shaft to the writing format."""
        return HighSpeedShaftWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of high speed shaft to the reading format.

Source code in examples/wind_turbine/data_classes/_high_speed_shaft.py
def as_read(self) -> HighSpeedShaft:
    """Convert this GraphQL format of high speed shaft to the reading format."""
    return HighSpeedShaft.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of high speed shaft to the writing format.

Source code in examples/wind_turbine/data_classes/_high_speed_shaft.py
def as_write(self) -> HighSpeedShaftWrite:
    """Convert this GraphQL format of high speed shaft to the writing format."""
    return HighSpeedShaftWrite.model_validate(as_write_args(self))

HighSpeedShaftList

Bases: DomainModelList[HighSpeedShaft]

List of high speed shafts in the read version.

Source code in examples/wind_turbine/data_classes/_high_speed_shaft.py
class HighSpeedShaftList(DomainModelList[HighSpeedShaft]):
    """List of high speed shafts in the read version."""

    _INSTANCE = HighSpeedShaft

    def as_write(self) -> HighSpeedShaftWriteList:
        """Convert these read versions of high speed shaft to the writing versions."""
        return HighSpeedShaftWriteList([node.as_write() for node in self.data])

    @property
    def bending_moment_y(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.bending_moment_y for item in self.data if isinstance(item.bending_moment_y, SensorTimeSeries)]
        )

    @property
    def bending_monent_x(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.bending_monent_x for item in self.data if isinstance(item.bending_monent_x, SensorTimeSeries)]
        )

    @property
    def nacelle(self) -> NacelleList:
        from ._nacelle import Nacelle, NacelleList

        return NacelleList([item.nacelle for item in self.data if isinstance(item.nacelle, Nacelle)])

    @property
    def torque(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList([item.torque for item in self.data if isinstance(item.torque, SensorTimeSeries)])

as_write()

Convert these read versions of high speed shaft to the writing versions.

Source code in examples/wind_turbine/data_classes/_high_speed_shaft.py
def as_write(self) -> HighSpeedShaftWriteList:
    """Convert these read versions of high speed shaft to the writing versions."""
    return HighSpeedShaftWriteList([node.as_write() for node in self.data])

HighSpeedShaftWrite

Bases: DomainModelWrite

This represents the writing version of high speed shaft.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the high speed shaft.

required
data_record

The data record of the high speed shaft node.

required
bending_moment_y

The bending moment y field.

required
bending_monent_x

The bending monent x field.

required
torque

The torque field.

required
Source code in examples/wind_turbine/data_classes/_high_speed_shaft.py
class HighSpeedShaftWrite(DomainModelWrite):
    """This represents the writing version of high speed shaft.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the high speed shaft.
        data_record: The data record of the high speed shaft node.
        bending_moment_y: The bending moment y field.
        bending_monent_x: The bending monent x field.
        torque: The torque field.
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "bending_moment_y",
        "bending_monent_x",
        "torque",
    )
    _direct_relations: ClassVar[tuple[str, ...]] = (
        "bending_moment_y",
        "bending_monent_x",
        "torque",
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "HighSpeedShaft", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    bending_moment_y: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    bending_monent_x: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    torque: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)

    @field_validator("bending_moment_y", "bending_monent_x", "torque", mode="before")
    def as_node_id(cls, value: Any) -> Any:
        if isinstance(value, dm.DirectRelationReference):
            return dm.NodeId(value.space, value.external_id)
        elif isinstance(value, tuple) and len(value) == 2 and all(isinstance(item, str) for item in value):
            return dm.NodeId(value[0], value[1])
        elif isinstance(value, list):
            return [cls.as_node_id(item) for item in value]
        return value

HighSpeedShaftWriteList

Bases: DomainModelWriteList[HighSpeedShaftWrite]

List of high speed shafts in the writing version.

Source code in examples/wind_turbine/data_classes/_high_speed_shaft.py
class HighSpeedShaftWriteList(DomainModelWriteList[HighSpeedShaftWrite]):
    """List of high speed shafts in the writing version."""

    _INSTANCE = HighSpeedShaftWrite

    @property
    def bending_moment_y(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [item.bending_moment_y for item in self.data if isinstance(item.bending_moment_y, SensorTimeSeriesWrite)]
        )

    @property
    def bending_monent_x(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [item.bending_monent_x for item in self.data if isinstance(item.bending_monent_x, SensorTimeSeriesWrite)]
        )

    @property
    def torque(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [item.torque for item in self.data if isinstance(item.torque, SensorTimeSeriesWrite)]
        )

MainShaft

Bases: DomainModel

This represents the reading version of main shaft.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the main shaft.

required
data_record

The data record of the main shaft node.

required
bending_x

The bending x field.

required
bending_y

The bending y field.

required
calculated_tilt_moment

The calculated tilt moment field.

required
calculated_yaw_moment

The calculated yaw moment field.

required
nacelle

The nacelle field.

required
torque

The torque field.

required
Source code in examples/wind_turbine/data_classes/_main_shaft.py
class MainShaft(DomainModel):
    """This represents the reading version of main shaft.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the main shaft.
        data_record: The data record of the main shaft node.
        bending_x: The bending x field.
        bending_y: The bending y field.
        calculated_tilt_moment: The calculated tilt moment field.
        calculated_yaw_moment: The calculated yaw moment field.
        nacelle: The nacelle field.
        torque: The torque field.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "MainShaft", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, None] = None
    bending_x: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    bending_y: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    calculated_tilt_moment: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    calculated_yaw_moment: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    nacelle: Optional[Nacelle] = Field(default=None, repr=False)
    torque: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)

    @field_validator(
        "bending_x", "bending_y", "calculated_tilt_moment", "calculated_yaw_moment", "nacelle", "torque", mode="before"
    )
    @classmethod
    def parse_single(cls, value: Any, info: ValidationInfo) -> Any:
        return parse_single_connection(value, info.field_name)

    def as_write(self) -> MainShaftWrite:
        """Convert this read version of main shaft to the writing version."""
        return MainShaftWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of main shaft to the writing version.

Source code in examples/wind_turbine/data_classes/_main_shaft.py
def as_write(self) -> MainShaftWrite:
    """Convert this read version of main shaft to the writing version."""
    return MainShaftWrite.model_validate(as_write_args(self))

MainShaftGraphQL

Bases: GraphQLCore

This represents the reading version of main shaft, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the main shaft.

required
data_record

The data record of the main shaft node.

required
bending_x

The bending x field.

required
bending_y

The bending y field.

required
calculated_tilt_moment

The calculated tilt moment field.

required
calculated_yaw_moment

The calculated yaw moment field.

required
nacelle

The nacelle field.

required
torque

The torque field.

required
Source code in examples/wind_turbine/data_classes/_main_shaft.py
class MainShaftGraphQL(GraphQLCore):
    """This represents the reading version of main shaft, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the main shaft.
        data_record: The data record of the main shaft node.
        bending_x: The bending x field.
        bending_y: The bending y field.
        calculated_tilt_moment: The calculated tilt moment field.
        calculated_yaw_moment: The calculated yaw moment field.
        nacelle: The nacelle field.
        torque: The torque field.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "MainShaft", "1")
    bending_x: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    bending_y: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    calculated_tilt_moment: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    calculated_yaw_moment: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    nacelle: Optional[NacelleGraphQL] = Field(default=None, repr=False)
    torque: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    @field_validator(
        "bending_x", "bending_y", "calculated_tilt_moment", "calculated_yaw_moment", "nacelle", "torque", mode="before"
    )
    def parse_graphql(cls, value: Any) -> Any:
        if not isinstance(value, dict):
            return value
        if "items" in value:
            return value["items"]
        return value

    def as_read(self) -> MainShaft:
        """Convert this GraphQL format of main shaft to the reading format."""
        return MainShaft.model_validate(as_read_args(self))

    def as_write(self) -> MainShaftWrite:
        """Convert this GraphQL format of main shaft to the writing format."""
        return MainShaftWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of main shaft to the reading format.

Source code in examples/wind_turbine/data_classes/_main_shaft.py
def as_read(self) -> MainShaft:
    """Convert this GraphQL format of main shaft to the reading format."""
    return MainShaft.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of main shaft to the writing format.

Source code in examples/wind_turbine/data_classes/_main_shaft.py
def as_write(self) -> MainShaftWrite:
    """Convert this GraphQL format of main shaft to the writing format."""
    return MainShaftWrite.model_validate(as_write_args(self))

MainShaftList

Bases: DomainModelList[MainShaft]

List of main shafts in the read version.

Source code in examples/wind_turbine/data_classes/_main_shaft.py
class MainShaftList(DomainModelList[MainShaft]):
    """List of main shafts in the read version."""

    _INSTANCE = MainShaft

    def as_write(self) -> MainShaftWriteList:
        """Convert these read versions of main shaft to the writing versions."""
        return MainShaftWriteList([node.as_write() for node in self.data])

    @property
    def bending_x(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.bending_x for item in self.data if isinstance(item.bending_x, SensorTimeSeries)]
        )

    @property
    def bending_y(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.bending_y for item in self.data if isinstance(item.bending_y, SensorTimeSeries)]
        )

    @property
    def calculated_tilt_moment(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [
                item.calculated_tilt_moment
                for item in self.data
                if isinstance(item.calculated_tilt_moment, SensorTimeSeries)
            ]
        )

    @property
    def calculated_yaw_moment(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [
                item.calculated_yaw_moment
                for item in self.data
                if isinstance(item.calculated_yaw_moment, SensorTimeSeries)
            ]
        )

    @property
    def nacelle(self) -> NacelleList:
        from ._nacelle import Nacelle, NacelleList

        return NacelleList([item.nacelle for item in self.data if isinstance(item.nacelle, Nacelle)])

    @property
    def torque(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList([item.torque for item in self.data if isinstance(item.torque, SensorTimeSeries)])

as_write()

Convert these read versions of main shaft to the writing versions.

Source code in examples/wind_turbine/data_classes/_main_shaft.py
def as_write(self) -> MainShaftWriteList:
    """Convert these read versions of main shaft to the writing versions."""
    return MainShaftWriteList([node.as_write() for node in self.data])

MainShaftWrite

Bases: DomainModelWrite

This represents the writing version of main shaft.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the main shaft.

required
data_record

The data record of the main shaft node.

required
bending_x

The bending x field.

required
bending_y

The bending y field.

required
calculated_tilt_moment

The calculated tilt moment field.

required
calculated_yaw_moment

The calculated yaw moment field.

required
torque

The torque field.

required
Source code in examples/wind_turbine/data_classes/_main_shaft.py
class MainShaftWrite(DomainModelWrite):
    """This represents the writing version of main shaft.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the main shaft.
        data_record: The data record of the main shaft node.
        bending_x: The bending x field.
        bending_y: The bending y field.
        calculated_tilt_moment: The calculated tilt moment field.
        calculated_yaw_moment: The calculated yaw moment field.
        torque: The torque field.
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "bending_x",
        "bending_y",
        "calculated_tilt_moment",
        "calculated_yaw_moment",
        "torque",
    )
    _direct_relations: ClassVar[tuple[str, ...]] = (
        "bending_x",
        "bending_y",
        "calculated_tilt_moment",
        "calculated_yaw_moment",
        "torque",
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "MainShaft", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    bending_x: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    bending_y: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    calculated_tilt_moment: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    calculated_yaw_moment: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    torque: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)

    @field_validator(
        "bending_x", "bending_y", "calculated_tilt_moment", "calculated_yaw_moment", "torque", mode="before"
    )
    def as_node_id(cls, value: Any) -> Any:
        if isinstance(value, dm.DirectRelationReference):
            return dm.NodeId(value.space, value.external_id)
        elif isinstance(value, tuple) and len(value) == 2 and all(isinstance(item, str) for item in value):
            return dm.NodeId(value[0], value[1])
        elif isinstance(value, list):
            return [cls.as_node_id(item) for item in value]
        return value

MainShaftWriteList

Bases: DomainModelWriteList[MainShaftWrite]

List of main shafts in the writing version.

Source code in examples/wind_turbine/data_classes/_main_shaft.py
class MainShaftWriteList(DomainModelWriteList[MainShaftWrite]):
    """List of main shafts in the writing version."""

    _INSTANCE = MainShaftWrite

    @property
    def bending_x(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [item.bending_x for item in self.data if isinstance(item.bending_x, SensorTimeSeriesWrite)]
        )

    @property
    def bending_y(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [item.bending_y for item in self.data if isinstance(item.bending_y, SensorTimeSeriesWrite)]
        )

    @property
    def calculated_tilt_moment(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.calculated_tilt_moment
                for item in self.data
                if isinstance(item.calculated_tilt_moment, SensorTimeSeriesWrite)
            ]
        )

    @property
    def calculated_yaw_moment(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.calculated_yaw_moment
                for item in self.data
                if isinstance(item.calculated_yaw_moment, SensorTimeSeriesWrite)
            ]
        )

    @property
    def torque(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [item.torque for item in self.data if isinstance(item.torque, SensorTimeSeriesWrite)]
        )

Metmast

Bases: DomainModel

This represents the reading version of metmast.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the metmast.

required
data_record

The data record of the metmast node.

required
position

The position field.

required
temperature

The temperature field.

required
tilt_angle

The tilt angle field.

required
wind_speed

The wind speed field.

required
wind_turbines

The wind turbine field.

required
Source code in examples/wind_turbine/data_classes/_metmast.py
class Metmast(DomainModel):
    """This represents the reading version of metmast.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the metmast.
        data_record: The data record of the metmast node.
        position: The position field.
        temperature: The temperature field.
        tilt_angle: The tilt angle field.
        wind_speed: The wind speed field.
        wind_turbines: The wind turbine field.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Metmast", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, None] = None
    position: Optional[float] = None
    temperature: Union[TimeSeries, str, None] = None
    tilt_angle: Union[TimeSeries, str, None] = None
    wind_speed: Union[TimeSeries, str, None] = None
    wind_turbines: Optional[list[Distance]] = Field(default=None, repr=False)

    @field_validator("wind_turbines", mode="before")
    @classmethod
    def parse_list(cls, value: Any, info: ValidationInfo) -> Any:
        if value is None:
            return None
        return [parse_single_connection(item, info.field_name) for item in value]

    def as_write(self) -> MetmastWrite:
        """Convert this read version of metmast to the writing version."""
        return MetmastWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of metmast to the writing version.

Source code in examples/wind_turbine/data_classes/_metmast.py
def as_write(self) -> MetmastWrite:
    """Convert this read version of metmast to the writing version."""
    return MetmastWrite.model_validate(as_write_args(self))

MetmastGraphQL

Bases: GraphQLCore

This represents the reading version of metmast, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the metmast.

required
data_record

The data record of the metmast node.

required
position

The position field.

required
temperature

The temperature field.

required
tilt_angle

The tilt angle field.

required
wind_speed

The wind speed field.

required
wind_turbines

The wind turbine field.

required
Source code in examples/wind_turbine/data_classes/_metmast.py
class MetmastGraphQL(GraphQLCore):
    """This represents the reading version of metmast, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the metmast.
        data_record: The data record of the metmast node.
        position: The position field.
        temperature: The temperature field.
        tilt_angle: The tilt angle field.
        wind_speed: The wind speed field.
        wind_turbines: The wind turbine field.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Metmast", "1")
    position: Optional[float] = None
    temperature: Optional[TimeSeriesGraphQL] = None
    tilt_angle: Optional[TimeSeriesGraphQL] = None
    wind_speed: Optional[TimeSeriesGraphQL] = None
    wind_turbines: Optional[list[DistanceGraphQL]] = Field(default=None, repr=False)

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    @field_validator("wind_turbines", mode="before")
    def parse_graphql(cls, value: Any) -> Any:
        if not isinstance(value, dict):
            return value
        if "items" in value:
            return value["items"]
        return value

    def as_read(self) -> Metmast:
        """Convert this GraphQL format of metmast to the reading format."""
        return Metmast.model_validate(as_read_args(self))

    def as_write(self) -> MetmastWrite:
        """Convert this GraphQL format of metmast to the writing format."""
        return MetmastWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of metmast to the reading format.

Source code in examples/wind_turbine/data_classes/_metmast.py
def as_read(self) -> Metmast:
    """Convert this GraphQL format of metmast to the reading format."""
    return Metmast.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of metmast to the writing format.

Source code in examples/wind_turbine/data_classes/_metmast.py
def as_write(self) -> MetmastWrite:
    """Convert this GraphQL format of metmast to the writing format."""
    return MetmastWrite.model_validate(as_write_args(self))

MetmastList

Bases: DomainModelList[Metmast]

List of metmasts in the read version.

Source code in examples/wind_turbine/data_classes/_metmast.py
class MetmastList(DomainModelList[Metmast]):
    """List of metmasts in the read version."""

    _INSTANCE = Metmast

    def as_write(self) -> MetmastWriteList:
        """Convert these read versions of metmast to the writing versions."""
        return MetmastWriteList([node.as_write() for node in self.data])

    @property
    def wind_turbines(self) -> DistanceList:
        from ._distance import Distance, DistanceList

        return DistanceList(
            [item for items in self.data for item in items.wind_turbines or [] if isinstance(item, Distance)]
        )

as_write()

Convert these read versions of metmast to the writing versions.

Source code in examples/wind_turbine/data_classes/_metmast.py
def as_write(self) -> MetmastWriteList:
    """Convert these read versions of metmast to the writing versions."""
    return MetmastWriteList([node.as_write() for node in self.data])

MetmastWrite

Bases: DomainModelWrite

This represents the writing version of metmast.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the metmast.

required
data_record

The data record of the metmast node.

required
position

The position field.

required
temperature

The temperature field.

required
tilt_angle

The tilt angle field.

required
wind_speed

The wind speed field.

required
wind_turbines

The wind turbine field.

required
Source code in examples/wind_turbine/data_classes/_metmast.py
class MetmastWrite(DomainModelWrite):
    """This represents the writing version of metmast.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the metmast.
        data_record: The data record of the metmast node.
        position: The position field.
        temperature: The temperature field.
        tilt_angle: The tilt angle field.
        wind_speed: The wind speed field.
        wind_turbines: The wind turbine field.
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "position",
        "temperature",
        "tilt_angle",
        "wind_speed",
    )
    _inwards_edges: ClassVar[tuple[tuple[str, dm.DirectRelationReference], ...]] = (
        ("wind_turbines", dm.DirectRelationReference("sp_pygen_power_enterprise", "Distance")),
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Metmast", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    position: Optional[float] = None
    temperature: Union[TimeSeriesWrite, str, None] = None
    tilt_angle: Union[TimeSeriesWrite, str, None] = None
    wind_speed: Union[TimeSeriesWrite, str, None] = None
    wind_turbines: Optional[list[DistanceWrite]] = Field(default=None, repr=False)

    @field_validator("wind_turbines", mode="before")
    def as_node_id(cls, value: Any) -> Any:
        if isinstance(value, dm.DirectRelationReference):
            return dm.NodeId(value.space, value.external_id)
        elif isinstance(value, tuple) and len(value) == 2 and all(isinstance(item, str) for item in value):
            return dm.NodeId(value[0], value[1])
        elif isinstance(value, list):
            return [cls.as_node_id(item) for item in value]
        return value

MetmastWriteList

Bases: DomainModelWriteList[MetmastWrite]

List of metmasts in the writing version.

Source code in examples/wind_turbine/data_classes/_metmast.py
class MetmastWriteList(DomainModelWriteList[MetmastWrite]):
    """List of metmasts in the writing version."""

    _INSTANCE = MetmastWrite

    @property
    def wind_turbines(self) -> DistanceWriteList:
        from ._distance import DistanceWrite, DistanceWriteList

        return DistanceWriteList(
            [item for items in self.data for item in items.wind_turbines or [] if isinstance(item, DistanceWrite)]
        )

Nacelle

Bases: DomainModel

This represents the reading version of nacelle.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the nacelle.

required
data_record

The data record of the nacelle node.

required
acc_from_back_side_x

The acc from back side x field.

required
acc_from_back_side_y

The acc from back side y field.

required
acc_from_back_side_z

The acc from back side z field.

required
gearbox

The gearbox field.

required
generator

The generator field.

required
high_speed_shaft

The high speed shaft field.

required
main_shaft

The main shaft field.

required
power_inverter

The power inverter field.

required
wind_turbine

The wind turbine field.

required
yaw_direction

The yaw direction field.

required
yaw_error

The yaw error field.

required
Source code in examples/wind_turbine/data_classes/_nacelle.py
class Nacelle(DomainModel):
    """This represents the reading version of nacelle.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the nacelle.
        data_record: The data record of the nacelle node.
        acc_from_back_side_x: The acc from back side x field.
        acc_from_back_side_y: The acc from back side y field.
        acc_from_back_side_z: The acc from back side z field.
        gearbox: The gearbox field.
        generator: The generator field.
        high_speed_shaft: The high speed shaft field.
        main_shaft: The main shaft field.
        power_inverter: The power inverter field.
        wind_turbine: The wind turbine field.
        yaw_direction: The yaw direction field.
        yaw_error: The yaw error field.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Nacelle", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, None] = None
    acc_from_back_side_x: Union[str, dm.NodeId, None] = Field(default=None)
    acc_from_back_side_y: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    acc_from_back_side_z: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    gearbox: Union[Gearbox, str, dm.NodeId, None] = Field(default=None, repr=False)
    generator: Union[Generator, str, dm.NodeId, None] = Field(default=None, repr=False)
    high_speed_shaft: Union[HighSpeedShaft, str, dm.NodeId, None] = Field(default=None, repr=False)
    main_shaft: Union[MainShaft, str, dm.NodeId, None] = Field(default=None, repr=False)
    power_inverter: Union[PowerInverter, str, dm.NodeId, None] = Field(default=None, repr=False)
    wind_turbine: Optional[WindTurbine] = Field(default=None, repr=False)
    yaw_direction: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    yaw_error: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)

    @field_validator(
        "acc_from_back_side_x",
        "acc_from_back_side_y",
        "acc_from_back_side_z",
        "gearbox",
        "generator",
        "high_speed_shaft",
        "main_shaft",
        "power_inverter",
        "wind_turbine",
        "yaw_direction",
        "yaw_error",
        mode="before",
    )
    @classmethod
    def parse_single(cls, value: Any, info: ValidationInfo) -> Any:
        return parse_single_connection(value, info.field_name)

    def as_write(self) -> NacelleWrite:
        """Convert this read version of nacelle to the writing version."""
        return NacelleWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of nacelle to the writing version.

Source code in examples/wind_turbine/data_classes/_nacelle.py
def as_write(self) -> NacelleWrite:
    """Convert this read version of nacelle to the writing version."""
    return NacelleWrite.model_validate(as_write_args(self))

NacelleGraphQL

Bases: GraphQLCore

This represents the reading version of nacelle, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the nacelle.

required
data_record

The data record of the nacelle node.

required
acc_from_back_side_x

The acc from back side x field.

required
acc_from_back_side_y

The acc from back side y field.

required
acc_from_back_side_z

The acc from back side z field.

required
gearbox

The gearbox field.

required
generator

The generator field.

required
high_speed_shaft

The high speed shaft field.

required
main_shaft

The main shaft field.

required
power_inverter

The power inverter field.

required
wind_turbine

The wind turbine field.

required
yaw_direction

The yaw direction field.

required
yaw_error

The yaw error field.

required
Source code in examples/wind_turbine/data_classes/_nacelle.py
class NacelleGraphQL(GraphQLCore):
    """This represents the reading version of nacelle, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the nacelle.
        data_record: The data record of the nacelle node.
        acc_from_back_side_x: The acc from back side x field.
        acc_from_back_side_y: The acc from back side y field.
        acc_from_back_side_z: The acc from back side z field.
        gearbox: The gearbox field.
        generator: The generator field.
        high_speed_shaft: The high speed shaft field.
        main_shaft: The main shaft field.
        power_inverter: The power inverter field.
        wind_turbine: The wind turbine field.
        yaw_direction: The yaw direction field.
        yaw_error: The yaw error field.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Nacelle", "1")
    acc_from_back_side_x: Optional[dict] = Field(default=None)
    acc_from_back_side_y: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    acc_from_back_side_z: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    gearbox: Optional[GearboxGraphQL] = Field(default=None, repr=False)
    generator: Optional[GeneratorGraphQL] = Field(default=None, repr=False)
    high_speed_shaft: Optional[HighSpeedShaftGraphQL] = Field(default=None, repr=False)
    main_shaft: Optional[MainShaftGraphQL] = Field(default=None, repr=False)
    power_inverter: Optional[PowerInverterGraphQL] = Field(default=None, repr=False)
    wind_turbine: Optional[WindTurbineGraphQL] = Field(default=None, repr=False)
    yaw_direction: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    yaw_error: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    @field_validator(
        "acc_from_back_side_x",
        "acc_from_back_side_y",
        "acc_from_back_side_z",
        "gearbox",
        "generator",
        "high_speed_shaft",
        "main_shaft",
        "power_inverter",
        "wind_turbine",
        "yaw_direction",
        "yaw_error",
        mode="before",
    )
    def parse_graphql(cls, value: Any) -> Any:
        if not isinstance(value, dict):
            return value
        if "items" in value:
            return value["items"]
        return value

    def as_read(self) -> Nacelle:
        """Convert this GraphQL format of nacelle to the reading format."""
        return Nacelle.model_validate(as_read_args(self))

    def as_write(self) -> NacelleWrite:
        """Convert this GraphQL format of nacelle to the writing format."""
        return NacelleWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of nacelle to the reading format.

Source code in examples/wind_turbine/data_classes/_nacelle.py
def as_read(self) -> Nacelle:
    """Convert this GraphQL format of nacelle to the reading format."""
    return Nacelle.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of nacelle to the writing format.

Source code in examples/wind_turbine/data_classes/_nacelle.py
def as_write(self) -> NacelleWrite:
    """Convert this GraphQL format of nacelle to the writing format."""
    return NacelleWrite.model_validate(as_write_args(self))

NacelleList

Bases: DomainModelList[Nacelle]

List of nacelles in the read version.

Source code in examples/wind_turbine/data_classes/_nacelle.py
class NacelleList(DomainModelList[Nacelle]):
    """List of nacelles in the read version."""

    _INSTANCE = Nacelle

    def as_write(self) -> NacelleWriteList:
        """Convert these read versions of nacelle to the writing versions."""
        return NacelleWriteList([node.as_write() for node in self.data])

    @property
    def acc_from_back_side_y(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.acc_from_back_side_y for item in self.data if isinstance(item.acc_from_back_side_y, SensorTimeSeries)]
        )

    @property
    def acc_from_back_side_z(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.acc_from_back_side_z for item in self.data if isinstance(item.acc_from_back_side_z, SensorTimeSeries)]
        )

    @property
    def gearbox(self) -> GearboxList:
        from ._gearbox import Gearbox, GearboxList

        return GearboxList([item.gearbox for item in self.data if isinstance(item.gearbox, Gearbox)])

    @property
    def generator(self) -> GeneratorList:
        from ._generator import Generator, GeneratorList

        return GeneratorList([item.generator for item in self.data if isinstance(item.generator, Generator)])

    @property
    def high_speed_shaft(self) -> HighSpeedShaftList:
        from ._high_speed_shaft import HighSpeedShaft, HighSpeedShaftList

        return HighSpeedShaftList(
            [item.high_speed_shaft for item in self.data if isinstance(item.high_speed_shaft, HighSpeedShaft)]
        )

    @property
    def main_shaft(self) -> MainShaftList:
        from ._main_shaft import MainShaft, MainShaftList

        return MainShaftList([item.main_shaft for item in self.data if isinstance(item.main_shaft, MainShaft)])

    @property
    def power_inverter(self) -> PowerInverterList:
        from ._power_inverter import PowerInverter, PowerInverterList

        return PowerInverterList(
            [item.power_inverter for item in self.data if isinstance(item.power_inverter, PowerInverter)]
        )

    @property
    def wind_turbine(self) -> WindTurbineList:
        from ._wind_turbine import WindTurbine, WindTurbineList

        return WindTurbineList([item.wind_turbine for item in self.data if isinstance(item.wind_turbine, WindTurbine)])

    @property
    def yaw_direction(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.yaw_direction for item in self.data if isinstance(item.yaw_direction, SensorTimeSeries)]
        )

    @property
    def yaw_error(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.yaw_error for item in self.data if isinstance(item.yaw_error, SensorTimeSeries)]
        )

as_write()

Convert these read versions of nacelle to the writing versions.

Source code in examples/wind_turbine/data_classes/_nacelle.py
def as_write(self) -> NacelleWriteList:
    """Convert these read versions of nacelle to the writing versions."""
    return NacelleWriteList([node.as_write() for node in self.data])

NacelleWrite

Bases: DomainModelWrite

This represents the writing version of nacelle.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the nacelle.

required
data_record

The data record of the nacelle node.

required
acc_from_back_side_x

The acc from back side x field.

required
acc_from_back_side_y

The acc from back side y field.

required
acc_from_back_side_z

The acc from back side z field.

required
gearbox

The gearbox field.

required
generator

The generator field.

required
high_speed_shaft

The high speed shaft field.

required
main_shaft

The main shaft field.

required
power_inverter

The power inverter field.

required
yaw_direction

The yaw direction field.

required
yaw_error

The yaw error field.

required
Source code in examples/wind_turbine/data_classes/_nacelle.py
class NacelleWrite(DomainModelWrite):
    """This represents the writing version of nacelle.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the nacelle.
        data_record: The data record of the nacelle node.
        acc_from_back_side_x: The acc from back side x field.
        acc_from_back_side_y: The acc from back side y field.
        acc_from_back_side_z: The acc from back side z field.
        gearbox: The gearbox field.
        generator: The generator field.
        high_speed_shaft: The high speed shaft field.
        main_shaft: The main shaft field.
        power_inverter: The power inverter field.
        yaw_direction: The yaw direction field.
        yaw_error: The yaw error field.
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "acc_from_back_side_x",
        "acc_from_back_side_y",
        "acc_from_back_side_z",
        "gearbox",
        "generator",
        "high_speed_shaft",
        "main_shaft",
        "power_inverter",
        "yaw_direction",
        "yaw_error",
    )
    _direct_relations: ClassVar[tuple[str, ...]] = (
        "acc_from_back_side_y",
        "acc_from_back_side_z",
        "gearbox",
        "generator",
        "high_speed_shaft",
        "main_shaft",
        "power_inverter",
        "yaw_direction",
        "yaw_error",
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Nacelle", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    acc_from_back_side_x: Union[str, dm.NodeId, None] = Field(default=None)
    acc_from_back_side_y: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    acc_from_back_side_z: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    gearbox: Union[GearboxWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    generator: Union[GeneratorWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    high_speed_shaft: Union[HighSpeedShaftWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    main_shaft: Union[MainShaftWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    power_inverter: Union[PowerInverterWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    yaw_direction: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    yaw_error: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)

    @field_validator(
        "acc_from_back_side_y",
        "acc_from_back_side_z",
        "gearbox",
        "generator",
        "high_speed_shaft",
        "main_shaft",
        "power_inverter",
        "yaw_direction",
        "yaw_error",
        mode="before",
    )
    def as_node_id(cls, value: Any) -> Any:
        if isinstance(value, dm.DirectRelationReference):
            return dm.NodeId(value.space, value.external_id)
        elif isinstance(value, tuple) and len(value) == 2 and all(isinstance(item, str) for item in value):
            return dm.NodeId(value[0], value[1])
        elif isinstance(value, list):
            return [cls.as_node_id(item) for item in value]
        return value

NacelleWriteList

Bases: DomainModelWriteList[NacelleWrite]

List of nacelles in the writing version.

Source code in examples/wind_turbine/data_classes/_nacelle.py
class NacelleWriteList(DomainModelWriteList[NacelleWrite]):
    """List of nacelles in the writing version."""

    _INSTANCE = NacelleWrite

    @property
    def acc_from_back_side_y(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.acc_from_back_side_y
                for item in self.data
                if isinstance(item.acc_from_back_side_y, SensorTimeSeriesWrite)
            ]
        )

    @property
    def acc_from_back_side_z(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.acc_from_back_side_z
                for item in self.data
                if isinstance(item.acc_from_back_side_z, SensorTimeSeriesWrite)
            ]
        )

    @property
    def gearbox(self) -> GearboxWriteList:
        from ._gearbox import GearboxWrite, GearboxWriteList

        return GearboxWriteList([item.gearbox for item in self.data if isinstance(item.gearbox, GearboxWrite)])

    @property
    def generator(self) -> GeneratorWriteList:
        from ._generator import GeneratorWrite, GeneratorWriteList

        return GeneratorWriteList([item.generator for item in self.data if isinstance(item.generator, GeneratorWrite)])

    @property
    def high_speed_shaft(self) -> HighSpeedShaftWriteList:
        from ._high_speed_shaft import HighSpeedShaftWrite, HighSpeedShaftWriteList

        return HighSpeedShaftWriteList(
            [item.high_speed_shaft for item in self.data if isinstance(item.high_speed_shaft, HighSpeedShaftWrite)]
        )

    @property
    def main_shaft(self) -> MainShaftWriteList:
        from ._main_shaft import MainShaftWrite, MainShaftWriteList

        return MainShaftWriteList(
            [item.main_shaft for item in self.data if isinstance(item.main_shaft, MainShaftWrite)]
        )

    @property
    def power_inverter(self) -> PowerInverterWriteList:
        from ._power_inverter import PowerInverterWrite, PowerInverterWriteList

        return PowerInverterWriteList(
            [item.power_inverter for item in self.data if isinstance(item.power_inverter, PowerInverterWrite)]
        )

    @property
    def yaw_direction(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [item.yaw_direction for item in self.data if isinstance(item.yaw_direction, SensorTimeSeriesWrite)]
        )

    @property
    def yaw_error(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [item.yaw_error for item in self.data if isinstance(item.yaw_error, SensorTimeSeriesWrite)]
        )

PowerInverter

Bases: DomainModel

This represents the reading version of power inverter.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the power inverter.

required
data_record

The data record of the power inverter node.

required
active_power_total

The active power total field.

required
apparent_power_total

The apparent power total field.

required
nacelle

The nacelle field.

required
reactive_power_total

The reactive power total field.

required
Source code in examples/wind_turbine/data_classes/_power_inverter.py
class PowerInverter(DomainModel):
    """This represents the reading version of power inverter.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the power inverter.
        data_record: The data record of the power inverter node.
        active_power_total: The active power total field.
        apparent_power_total: The apparent power total field.
        nacelle: The nacelle field.
        reactive_power_total: The reactive power total field.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "PowerInverter", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, None] = None
    active_power_total: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    apparent_power_total: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    nacelle: Optional[Nacelle] = Field(default=None, repr=False)
    reactive_power_total: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)

    @field_validator("active_power_total", "apparent_power_total", "nacelle", "reactive_power_total", mode="before")
    @classmethod
    def parse_single(cls, value: Any, info: ValidationInfo) -> Any:
        return parse_single_connection(value, info.field_name)

    def as_write(self) -> PowerInverterWrite:
        """Convert this read version of power inverter to the writing version."""
        return PowerInverterWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of power inverter to the writing version.

Source code in examples/wind_turbine/data_classes/_power_inverter.py
def as_write(self) -> PowerInverterWrite:
    """Convert this read version of power inverter to the writing version."""
    return PowerInverterWrite.model_validate(as_write_args(self))

PowerInverterGraphQL

Bases: GraphQLCore

This represents the reading version of power inverter, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the power inverter.

required
data_record

The data record of the power inverter node.

required
active_power_total

The active power total field.

required
apparent_power_total

The apparent power total field.

required
nacelle

The nacelle field.

required
reactive_power_total

The reactive power total field.

required
Source code in examples/wind_turbine/data_classes/_power_inverter.py
class PowerInverterGraphQL(GraphQLCore):
    """This represents the reading version of power inverter, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the power inverter.
        data_record: The data record of the power inverter node.
        active_power_total: The active power total field.
        apparent_power_total: The apparent power total field.
        nacelle: The nacelle field.
        reactive_power_total: The reactive power total field.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "PowerInverter", "1")
    active_power_total: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    apparent_power_total: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    nacelle: Optional[NacelleGraphQL] = Field(default=None, repr=False)
    reactive_power_total: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    @field_validator("active_power_total", "apparent_power_total", "nacelle", "reactive_power_total", mode="before")
    def parse_graphql(cls, value: Any) -> Any:
        if not isinstance(value, dict):
            return value
        if "items" in value:
            return value["items"]
        return value

    def as_read(self) -> PowerInverter:
        """Convert this GraphQL format of power inverter to the reading format."""
        return PowerInverter.model_validate(as_read_args(self))

    def as_write(self) -> PowerInverterWrite:
        """Convert this GraphQL format of power inverter to the writing format."""
        return PowerInverterWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of power inverter to the reading format.

Source code in examples/wind_turbine/data_classes/_power_inverter.py
def as_read(self) -> PowerInverter:
    """Convert this GraphQL format of power inverter to the reading format."""
    return PowerInverter.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of power inverter to the writing format.

Source code in examples/wind_turbine/data_classes/_power_inverter.py
def as_write(self) -> PowerInverterWrite:
    """Convert this GraphQL format of power inverter to the writing format."""
    return PowerInverterWrite.model_validate(as_write_args(self))

PowerInverterList

Bases: DomainModelList[PowerInverter]

List of power inverters in the read version.

Source code in examples/wind_turbine/data_classes/_power_inverter.py
class PowerInverterList(DomainModelList[PowerInverter]):
    """List of power inverters in the read version."""

    _INSTANCE = PowerInverter

    def as_write(self) -> PowerInverterWriteList:
        """Convert these read versions of power inverter to the writing versions."""
        return PowerInverterWriteList([node.as_write() for node in self.data])

    @property
    def active_power_total(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.active_power_total for item in self.data if isinstance(item.active_power_total, SensorTimeSeries)]
        )

    @property
    def apparent_power_total(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.apparent_power_total for item in self.data if isinstance(item.apparent_power_total, SensorTimeSeries)]
        )

    @property
    def nacelle(self) -> NacelleList:
        from ._nacelle import Nacelle, NacelleList

        return NacelleList([item.nacelle for item in self.data if isinstance(item.nacelle, Nacelle)])

    @property
    def reactive_power_total(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.reactive_power_total for item in self.data if isinstance(item.reactive_power_total, SensorTimeSeries)]
        )

as_write()

Convert these read versions of power inverter to the writing versions.

Source code in examples/wind_turbine/data_classes/_power_inverter.py
def as_write(self) -> PowerInverterWriteList:
    """Convert these read versions of power inverter to the writing versions."""
    return PowerInverterWriteList([node.as_write() for node in self.data])

PowerInverterWrite

Bases: DomainModelWrite

This represents the writing version of power inverter.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the power inverter.

required
data_record

The data record of the power inverter node.

required
active_power_total

The active power total field.

required
apparent_power_total

The apparent power total field.

required
reactive_power_total

The reactive power total field.

required
Source code in examples/wind_turbine/data_classes/_power_inverter.py
class PowerInverterWrite(DomainModelWrite):
    """This represents the writing version of power inverter.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the power inverter.
        data_record: The data record of the power inverter node.
        active_power_total: The active power total field.
        apparent_power_total: The apparent power total field.
        reactive_power_total: The reactive power total field.
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "active_power_total",
        "apparent_power_total",
        "reactive_power_total",
    )
    _direct_relations: ClassVar[tuple[str, ...]] = (
        "active_power_total",
        "apparent_power_total",
        "reactive_power_total",
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "PowerInverter", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    active_power_total: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    apparent_power_total: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    reactive_power_total: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)

    @field_validator("active_power_total", "apparent_power_total", "reactive_power_total", mode="before")
    def as_node_id(cls, value: Any) -> Any:
        if isinstance(value, dm.DirectRelationReference):
            return dm.NodeId(value.space, value.external_id)
        elif isinstance(value, tuple) and len(value) == 2 and all(isinstance(item, str) for item in value):
            return dm.NodeId(value[0], value[1])
        elif isinstance(value, list):
            return [cls.as_node_id(item) for item in value]
        return value

PowerInverterWriteList

Bases: DomainModelWriteList[PowerInverterWrite]

List of power inverters in the writing version.

Source code in examples/wind_turbine/data_classes/_power_inverter.py
class PowerInverterWriteList(DomainModelWriteList[PowerInverterWrite]):
    """List of power inverters in the writing version."""

    _INSTANCE = PowerInverterWrite

    @property
    def active_power_total(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.active_power_total
                for item in self.data
                if isinstance(item.active_power_total, SensorTimeSeriesWrite)
            ]
        )

    @property
    def apparent_power_total(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.apparent_power_total
                for item in self.data
                if isinstance(item.apparent_power_total, SensorTimeSeriesWrite)
            ]
        )

    @property
    def reactive_power_total(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.reactive_power_total
                for item in self.data
                if isinstance(item.reactive_power_total, SensorTimeSeriesWrite)
            ]
        )

Rotor

Bases: DomainModel

This represents the reading version of rotor.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the rotor.

required
data_record

The data record of the rotor node.

required
rotor_speed_controller

The rotor speed controller field.

required
rpm_low_speed_shaft

The rpm low speed shaft field.

required
wind_turbine

The wind turbine field.

required
Source code in examples/wind_turbine/data_classes/_rotor.py
class Rotor(DomainModel):
    """This represents the reading version of rotor.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the rotor.
        data_record: The data record of the rotor node.
        rotor_speed_controller: The rotor speed controller field.
        rpm_low_speed_shaft: The rpm low speed shaft field.
        wind_turbine: The wind turbine field.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Rotor", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, None] = None
    rotor_speed_controller: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    rpm_low_speed_shaft: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    wind_turbine: Optional[WindTurbine] = Field(default=None, repr=False)

    @field_validator("rotor_speed_controller", "rpm_low_speed_shaft", "wind_turbine", mode="before")
    @classmethod
    def parse_single(cls, value: Any, info: ValidationInfo) -> Any:
        return parse_single_connection(value, info.field_name)

    def as_write(self) -> RotorWrite:
        """Convert this read version of rotor to the writing version."""
        return RotorWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of rotor to the writing version.

Source code in examples/wind_turbine/data_classes/_rotor.py
def as_write(self) -> RotorWrite:
    """Convert this read version of rotor to the writing version."""
    return RotorWrite.model_validate(as_write_args(self))

RotorGraphQL

Bases: GraphQLCore

This represents the reading version of rotor, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the rotor.

required
data_record

The data record of the rotor node.

required
rotor_speed_controller

The rotor speed controller field.

required
rpm_low_speed_shaft

The rpm low speed shaft field.

required
wind_turbine

The wind turbine field.

required
Source code in examples/wind_turbine/data_classes/_rotor.py
class RotorGraphQL(GraphQLCore):
    """This represents the reading version of rotor, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the rotor.
        data_record: The data record of the rotor node.
        rotor_speed_controller: The rotor speed controller field.
        rpm_low_speed_shaft: The rpm low speed shaft field.
        wind_turbine: The wind turbine field.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Rotor", "1")
    rotor_speed_controller: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    rpm_low_speed_shaft: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    wind_turbine: Optional[WindTurbineGraphQL] = Field(default=None, repr=False)

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    @field_validator("rotor_speed_controller", "rpm_low_speed_shaft", "wind_turbine", mode="before")
    def parse_graphql(cls, value: Any) -> Any:
        if not isinstance(value, dict):
            return value
        if "items" in value:
            return value["items"]
        return value

    def as_read(self) -> Rotor:
        """Convert this GraphQL format of rotor to the reading format."""
        return Rotor.model_validate(as_read_args(self))

    def as_write(self) -> RotorWrite:
        """Convert this GraphQL format of rotor to the writing format."""
        return RotorWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of rotor to the reading format.

Source code in examples/wind_turbine/data_classes/_rotor.py
def as_read(self) -> Rotor:
    """Convert this GraphQL format of rotor to the reading format."""
    return Rotor.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of rotor to the writing format.

Source code in examples/wind_turbine/data_classes/_rotor.py
def as_write(self) -> RotorWrite:
    """Convert this GraphQL format of rotor to the writing format."""
    return RotorWrite.model_validate(as_write_args(self))

RotorList

Bases: DomainModelList[Rotor]

List of rotors in the read version.

Source code in examples/wind_turbine/data_classes/_rotor.py
class RotorList(DomainModelList[Rotor]):
    """List of rotors in the read version."""

    _INSTANCE = Rotor

    def as_write(self) -> RotorWriteList:
        """Convert these read versions of rotor to the writing versions."""
        return RotorWriteList([node.as_write() for node in self.data])

    @property
    def rotor_speed_controller(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [
                item.rotor_speed_controller
                for item in self.data
                if isinstance(item.rotor_speed_controller, SensorTimeSeries)
            ]
        )

    @property
    def rpm_low_speed_shaft(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.rpm_low_speed_shaft for item in self.data if isinstance(item.rpm_low_speed_shaft, SensorTimeSeries)]
        )

    @property
    def wind_turbine(self) -> WindTurbineList:
        from ._wind_turbine import WindTurbine, WindTurbineList

        return WindTurbineList([item.wind_turbine for item in self.data if isinstance(item.wind_turbine, WindTurbine)])

as_write()

Convert these read versions of rotor to the writing versions.

Source code in examples/wind_turbine/data_classes/_rotor.py
def as_write(self) -> RotorWriteList:
    """Convert these read versions of rotor to the writing versions."""
    return RotorWriteList([node.as_write() for node in self.data])

RotorWrite

Bases: DomainModelWrite

This represents the writing version of rotor.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the rotor.

required
data_record

The data record of the rotor node.

required
rotor_speed_controller

The rotor speed controller field.

required
rpm_low_speed_shaft

The rpm low speed shaft field.

required
Source code in examples/wind_turbine/data_classes/_rotor.py
class RotorWrite(DomainModelWrite):
    """This represents the writing version of rotor.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the rotor.
        data_record: The data record of the rotor node.
        rotor_speed_controller: The rotor speed controller field.
        rpm_low_speed_shaft: The rpm low speed shaft field.
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "rotor_speed_controller",
        "rpm_low_speed_shaft",
    )
    _direct_relations: ClassVar[tuple[str, ...]] = (
        "rotor_speed_controller",
        "rpm_low_speed_shaft",
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "Rotor", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    rotor_speed_controller: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    rpm_low_speed_shaft: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)

    @field_validator("rotor_speed_controller", "rpm_low_speed_shaft", mode="before")
    def as_node_id(cls, value: Any) -> Any:
        if isinstance(value, dm.DirectRelationReference):
            return dm.NodeId(value.space, value.external_id)
        elif isinstance(value, tuple) and len(value) == 2 and all(isinstance(item, str) for item in value):
            return dm.NodeId(value[0], value[1])
        elif isinstance(value, list):
            return [cls.as_node_id(item) for item in value]
        return value

RotorWriteList

Bases: DomainModelWriteList[RotorWrite]

List of rotors in the writing version.

Source code in examples/wind_turbine/data_classes/_rotor.py
class RotorWriteList(DomainModelWriteList[RotorWrite]):
    """List of rotors in the writing version."""

    _INSTANCE = RotorWrite

    @property
    def rotor_speed_controller(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.rotor_speed_controller
                for item in self.data
                if isinstance(item.rotor_speed_controller, SensorTimeSeriesWrite)
            ]
        )

    @property
    def rpm_low_speed_shaft(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.rpm_low_speed_shaft
                for item in self.data
                if isinstance(item.rpm_low_speed_shaft, SensorTimeSeriesWrite)
            ]
        )

SensorPosition

Bases: DomainModel

This represents the reading version of sensor position.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the sensor position.

required
data_record

The data record of the sensor position node.

required
blade

The blade field.

required
edgewise_bend_mom_crosstalk_corrected

The edgewise bend mom crosstalk corrected field.

required
edgewise_bend_mom_offset

The edgewise bend mom offset field.

required
edgewise_bend_mom_offset_crosstalk_corrected

The edgewise bend mom offset crosstalk corrected field.

required
edgewisewise_bend_mom

The edgewisewise bend mom field.

required
flapwise_bend_mom

The flapwise bend mom field.

required
flapwise_bend_mom_crosstalk_corrected

The flapwise bend mom crosstalk corrected field.

required
flapwise_bend_mom_offset

The flapwise bend mom offset field.

required
flapwise_bend_mom_offset_crosstalk_corrected

The flapwise bend mom offset crosstalk corrected field.

required
position

The position field.

required
Source code in examples/wind_turbine/data_classes/_sensor_position.py
class SensorPosition(DomainModel):
    """This represents the reading version of sensor position.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the sensor position.
        data_record: The data record of the sensor position node.
        blade: The blade field.
        edgewise_bend_mom_crosstalk_corrected: The edgewise bend mom crosstalk corrected field.
        edgewise_bend_mom_offset: The edgewise bend mom offset field.
        edgewise_bend_mom_offset_crosstalk_corrected: The edgewise bend mom offset crosstalk corrected field.
        edgewisewise_bend_mom: The edgewisewise bend mom field.
        flapwise_bend_mom: The flapwise bend mom field.
        flapwise_bend_mom_crosstalk_corrected: The flapwise bend mom crosstalk corrected field.
        flapwise_bend_mom_offset: The flapwise bend mom offset field.
        flapwise_bend_mom_offset_crosstalk_corrected: The flapwise bend mom offset crosstalk corrected field.
        position: The position field.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "SensorPosition", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, None] = None
    blade: Union[Blade, str, dm.NodeId, None] = Field(default=None, repr=False)
    edgewise_bend_mom_crosstalk_corrected: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(
        default=None, repr=False
    )
    edgewise_bend_mom_offset: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    edgewise_bend_mom_offset_crosstalk_corrected: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(
        default=None, repr=False
    )
    edgewisewise_bend_mom: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    flapwise_bend_mom: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    flapwise_bend_mom_crosstalk_corrected: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(
        default=None, repr=False
    )
    flapwise_bend_mom_offset: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    flapwise_bend_mom_offset_crosstalk_corrected: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(
        default=None, repr=False
    )
    position: Optional[float] = None

    @field_validator(
        "blade",
        "edgewise_bend_mom_crosstalk_corrected",
        "edgewise_bend_mom_offset",
        "edgewise_bend_mom_offset_crosstalk_corrected",
        "edgewisewise_bend_mom",
        "flapwise_bend_mom",
        "flapwise_bend_mom_crosstalk_corrected",
        "flapwise_bend_mom_offset",
        "flapwise_bend_mom_offset_crosstalk_corrected",
        mode="before",
    )
    @classmethod
    def parse_single(cls, value: Any, info: ValidationInfo) -> Any:
        return parse_single_connection(value, info.field_name)

    def as_write(self) -> SensorPositionWrite:
        """Convert this read version of sensor position to the writing version."""
        return SensorPositionWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of sensor position to the writing version.

Source code in examples/wind_turbine/data_classes/_sensor_position.py
def as_write(self) -> SensorPositionWrite:
    """Convert this read version of sensor position to the writing version."""
    return SensorPositionWrite.model_validate(as_write_args(self))

SensorPositionGraphQL

Bases: GraphQLCore

This represents the reading version of sensor position, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the sensor position.

required
data_record

The data record of the sensor position node.

required
blade

The blade field.

required
edgewise_bend_mom_crosstalk_corrected

The edgewise bend mom crosstalk corrected field.

required
edgewise_bend_mom_offset

The edgewise bend mom offset field.

required
edgewise_bend_mom_offset_crosstalk_corrected

The edgewise bend mom offset crosstalk corrected field.

required
edgewisewise_bend_mom

The edgewisewise bend mom field.

required
flapwise_bend_mom

The flapwise bend mom field.

required
flapwise_bend_mom_crosstalk_corrected

The flapwise bend mom crosstalk corrected field.

required
flapwise_bend_mom_offset

The flapwise bend mom offset field.

required
flapwise_bend_mom_offset_crosstalk_corrected

The flapwise bend mom offset crosstalk corrected field.

required
position

The position field.

required
Source code in examples/wind_turbine/data_classes/_sensor_position.py
class SensorPositionGraphQL(GraphQLCore):
    """This represents the reading version of sensor position, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the sensor position.
        data_record: The data record of the sensor position node.
        blade: The blade field.
        edgewise_bend_mom_crosstalk_corrected: The edgewise bend mom crosstalk corrected field.
        edgewise_bend_mom_offset: The edgewise bend mom offset field.
        edgewise_bend_mom_offset_crosstalk_corrected: The edgewise bend mom offset crosstalk corrected field.
        edgewisewise_bend_mom: The edgewisewise bend mom field.
        flapwise_bend_mom: The flapwise bend mom field.
        flapwise_bend_mom_crosstalk_corrected: The flapwise bend mom crosstalk corrected field.
        flapwise_bend_mom_offset: The flapwise bend mom offset field.
        flapwise_bend_mom_offset_crosstalk_corrected: The flapwise bend mom offset crosstalk corrected field.
        position: The position field.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "SensorPosition", "1")
    blade: Optional[BladeGraphQL] = Field(default=None, repr=False)
    edgewise_bend_mom_crosstalk_corrected: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    edgewise_bend_mom_offset: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    edgewise_bend_mom_offset_crosstalk_corrected: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    edgewisewise_bend_mom: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    flapwise_bend_mom: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    flapwise_bend_mom_crosstalk_corrected: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    flapwise_bend_mom_offset: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    flapwise_bend_mom_offset_crosstalk_corrected: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    position: Optional[float] = None

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    @field_validator(
        "blade",
        "edgewise_bend_mom_crosstalk_corrected",
        "edgewise_bend_mom_offset",
        "edgewise_bend_mom_offset_crosstalk_corrected",
        "edgewisewise_bend_mom",
        "flapwise_bend_mom",
        "flapwise_bend_mom_crosstalk_corrected",
        "flapwise_bend_mom_offset",
        "flapwise_bend_mom_offset_crosstalk_corrected",
        mode="before",
    )
    def parse_graphql(cls, value: Any) -> Any:
        if not isinstance(value, dict):
            return value
        if "items" in value:
            return value["items"]
        return value

    def as_read(self) -> SensorPosition:
        """Convert this GraphQL format of sensor position to the reading format."""
        return SensorPosition.model_validate(as_read_args(self))

    def as_write(self) -> SensorPositionWrite:
        """Convert this GraphQL format of sensor position to the writing format."""
        return SensorPositionWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of sensor position to the reading format.

Source code in examples/wind_turbine/data_classes/_sensor_position.py
def as_read(self) -> SensorPosition:
    """Convert this GraphQL format of sensor position to the reading format."""
    return SensorPosition.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of sensor position to the writing format.

Source code in examples/wind_turbine/data_classes/_sensor_position.py
def as_write(self) -> SensorPositionWrite:
    """Convert this GraphQL format of sensor position to the writing format."""
    return SensorPositionWrite.model_validate(as_write_args(self))

SensorPositionList

Bases: DomainModelList[SensorPosition]

List of sensor positions in the read version.

Source code in examples/wind_turbine/data_classes/_sensor_position.py
class SensorPositionList(DomainModelList[SensorPosition]):
    """List of sensor positions in the read version."""

    _INSTANCE = SensorPosition

    def as_write(self) -> SensorPositionWriteList:
        """Convert these read versions of sensor position to the writing versions."""
        return SensorPositionWriteList([node.as_write() for node in self.data])

    @property
    def blade(self) -> BladeList:
        from ._blade import Blade, BladeList

        return BladeList([item.blade for item in self.data if isinstance(item.blade, Blade)])

    @property
    def edgewise_bend_mom_crosstalk_corrected(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [
                item.edgewise_bend_mom_crosstalk_corrected
                for item in self.data
                if isinstance(item.edgewise_bend_mom_crosstalk_corrected, SensorTimeSeries)
            ]
        )

    @property
    def edgewise_bend_mom_offset(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [
                item.edgewise_bend_mom_offset
                for item in self.data
                if isinstance(item.edgewise_bend_mom_offset, SensorTimeSeries)
            ]
        )

    @property
    def edgewise_bend_mom_offset_crosstalk_corrected(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [
                item.edgewise_bend_mom_offset_crosstalk_corrected
                for item in self.data
                if isinstance(item.edgewise_bend_mom_offset_crosstalk_corrected, SensorTimeSeries)
            ]
        )

    @property
    def edgewisewise_bend_mom(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [
                item.edgewisewise_bend_mom
                for item in self.data
                if isinstance(item.edgewisewise_bend_mom, SensorTimeSeries)
            ]
        )

    @property
    def flapwise_bend_mom(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.flapwise_bend_mom for item in self.data if isinstance(item.flapwise_bend_mom, SensorTimeSeries)]
        )

    @property
    def flapwise_bend_mom_crosstalk_corrected(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [
                item.flapwise_bend_mom_crosstalk_corrected
                for item in self.data
                if isinstance(item.flapwise_bend_mom_crosstalk_corrected, SensorTimeSeries)
            ]
        )

    @property
    def flapwise_bend_mom_offset(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [
                item.flapwise_bend_mom_offset
                for item in self.data
                if isinstance(item.flapwise_bend_mom_offset, SensorTimeSeries)
            ]
        )

    @property
    def flapwise_bend_mom_offset_crosstalk_corrected(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [
                item.flapwise_bend_mom_offset_crosstalk_corrected
                for item in self.data
                if isinstance(item.flapwise_bend_mom_offset_crosstalk_corrected, SensorTimeSeries)
            ]
        )

as_write()

Convert these read versions of sensor position to the writing versions.

Source code in examples/wind_turbine/data_classes/_sensor_position.py
def as_write(self) -> SensorPositionWriteList:
    """Convert these read versions of sensor position to the writing versions."""
    return SensorPositionWriteList([node.as_write() for node in self.data])

SensorPositionWrite

Bases: DomainModelWrite

This represents the writing version of sensor position.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the sensor position.

required
data_record

The data record of the sensor position node.

required
blade

The blade field.

required
edgewise_bend_mom_crosstalk_corrected

The edgewise bend mom crosstalk corrected field.

required
edgewise_bend_mom_offset

The edgewise bend mom offset field.

required
edgewise_bend_mom_offset_crosstalk_corrected

The edgewise bend mom offset crosstalk corrected field.

required
edgewisewise_bend_mom

The edgewisewise bend mom field.

required
flapwise_bend_mom

The flapwise bend mom field.

required
flapwise_bend_mom_crosstalk_corrected

The flapwise bend mom crosstalk corrected field.

required
flapwise_bend_mom_offset

The flapwise bend mom offset field.

required
flapwise_bend_mom_offset_crosstalk_corrected

The flapwise bend mom offset crosstalk corrected field.

required
position

The position field.

required
Source code in examples/wind_turbine/data_classes/_sensor_position.py
class SensorPositionWrite(DomainModelWrite):
    """This represents the writing version of sensor position.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the sensor position.
        data_record: The data record of the sensor position node.
        blade: The blade field.
        edgewise_bend_mom_crosstalk_corrected: The edgewise bend mom crosstalk corrected field.
        edgewise_bend_mom_offset: The edgewise bend mom offset field.
        edgewise_bend_mom_offset_crosstalk_corrected: The edgewise bend mom offset crosstalk corrected field.
        edgewisewise_bend_mom: The edgewisewise bend mom field.
        flapwise_bend_mom: The flapwise bend mom field.
        flapwise_bend_mom_crosstalk_corrected: The flapwise bend mom crosstalk corrected field.
        flapwise_bend_mom_offset: The flapwise bend mom offset field.
        flapwise_bend_mom_offset_crosstalk_corrected: The flapwise bend mom offset crosstalk corrected field.
        position: The position field.
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "blade",
        "edgewise_bend_mom_crosstalk_corrected",
        "edgewise_bend_mom_offset",
        "edgewise_bend_mom_offset_crosstalk_corrected",
        "edgewisewise_bend_mom",
        "flapwise_bend_mom",
        "flapwise_bend_mom_crosstalk_corrected",
        "flapwise_bend_mom_offset",
        "flapwise_bend_mom_offset_crosstalk_corrected",
        "position",
    )
    _direct_relations: ClassVar[tuple[str, ...]] = (
        "blade",
        "edgewise_bend_mom_crosstalk_corrected",
        "edgewise_bend_mom_offset",
        "edgewise_bend_mom_offset_crosstalk_corrected",
        "edgewisewise_bend_mom",
        "flapwise_bend_mom",
        "flapwise_bend_mom_crosstalk_corrected",
        "flapwise_bend_mom_offset",
        "flapwise_bend_mom_offset_crosstalk_corrected",
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "SensorPosition", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    blade: Union[BladeWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    edgewise_bend_mom_crosstalk_corrected: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(
        default=None, repr=False
    )
    edgewise_bend_mom_offset: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    edgewise_bend_mom_offset_crosstalk_corrected: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(
        default=None, repr=False
    )
    edgewisewise_bend_mom: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    flapwise_bend_mom: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    flapwise_bend_mom_crosstalk_corrected: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(
        default=None, repr=False
    )
    flapwise_bend_mom_offset: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    flapwise_bend_mom_offset_crosstalk_corrected: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(
        default=None, repr=False
    )
    position: Optional[float] = None

    @field_validator(
        "blade",
        "edgewise_bend_mom_crosstalk_corrected",
        "edgewise_bend_mom_offset",
        "edgewise_bend_mom_offset_crosstalk_corrected",
        "edgewisewise_bend_mom",
        "flapwise_bend_mom",
        "flapwise_bend_mom_crosstalk_corrected",
        "flapwise_bend_mom_offset",
        "flapwise_bend_mom_offset_crosstalk_corrected",
        mode="before",
    )
    def as_node_id(cls, value: Any) -> Any:
        if isinstance(value, dm.DirectRelationReference):
            return dm.NodeId(value.space, value.external_id)
        elif isinstance(value, tuple) and len(value) == 2 and all(isinstance(item, str) for item in value):
            return dm.NodeId(value[0], value[1])
        elif isinstance(value, list):
            return [cls.as_node_id(item) for item in value]
        return value

SensorPositionWriteList

Bases: DomainModelWriteList[SensorPositionWrite]

List of sensor positions in the writing version.

Source code in examples/wind_turbine/data_classes/_sensor_position.py
class SensorPositionWriteList(DomainModelWriteList[SensorPositionWrite]):
    """List of sensor positions in the writing version."""

    _INSTANCE = SensorPositionWrite

    @property
    def blade(self) -> BladeWriteList:
        from ._blade import BladeWrite, BladeWriteList

        return BladeWriteList([item.blade for item in self.data if isinstance(item.blade, BladeWrite)])

    @property
    def edgewise_bend_mom_crosstalk_corrected(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.edgewise_bend_mom_crosstalk_corrected
                for item in self.data
                if isinstance(item.edgewise_bend_mom_crosstalk_corrected, SensorTimeSeriesWrite)
            ]
        )

    @property
    def edgewise_bend_mom_offset(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.edgewise_bend_mom_offset
                for item in self.data
                if isinstance(item.edgewise_bend_mom_offset, SensorTimeSeriesWrite)
            ]
        )

    @property
    def edgewise_bend_mom_offset_crosstalk_corrected(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.edgewise_bend_mom_offset_crosstalk_corrected
                for item in self.data
                if isinstance(item.edgewise_bend_mom_offset_crosstalk_corrected, SensorTimeSeriesWrite)
            ]
        )

    @property
    def edgewisewise_bend_mom(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.edgewisewise_bend_mom
                for item in self.data
                if isinstance(item.edgewisewise_bend_mom, SensorTimeSeriesWrite)
            ]
        )

    @property
    def flapwise_bend_mom(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [item.flapwise_bend_mom for item in self.data if isinstance(item.flapwise_bend_mom, SensorTimeSeriesWrite)]
        )

    @property
    def flapwise_bend_mom_crosstalk_corrected(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.flapwise_bend_mom_crosstalk_corrected
                for item in self.data
                if isinstance(item.flapwise_bend_mom_crosstalk_corrected, SensorTimeSeriesWrite)
            ]
        )

    @property
    def flapwise_bend_mom_offset(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.flapwise_bend_mom_offset
                for item in self.data
                if isinstance(item.flapwise_bend_mom_offset, SensorTimeSeriesWrite)
            ]
        )

    @property
    def flapwise_bend_mom_offset_crosstalk_corrected(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [
                item.flapwise_bend_mom_offset_crosstalk_corrected
                for item in self.data
                if isinstance(item.flapwise_bend_mom_offset_crosstalk_corrected, SensorTimeSeriesWrite)
            ]
        )

SensorTimeSeries

Bases: DomainModel

This represents the reading version of sensor time series.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the sensor time series.

required
data_record

The data record of the sensor time series node.

required
aliases

Alternative names for the node

required
concept_id

The concept ID of the time series.

required
description

Description of the instance

required
is_step

Specifies whether the time series is a step time series or not.

required
name

Name of the instance

required
source_unit

The unit specified in the source system.

required
standard_name

The standard name of the time series.

required
type_

Specifies the data type of the data points.

required
Source code in examples/wind_turbine/data_classes/_sensor_time_series.py
class SensorTimeSeries(DomainModel):
    """This represents the reading version of sensor time series.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the sensor time series.
        data_record: The data record of the sensor time series node.
        aliases: Alternative names for the node
        concept_id: The concept ID of the time series.
        description: Description of the instance
        is_step: Specifies whether the time series is a step time series or not.
        name: Name of the instance
        source_unit: The unit specified in the source system.
        standard_name: The standard name of the time series.
        type_: Specifies the data type of the data points.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "SensorTimeSeries", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, None] = None
    aliases: Optional[list[str]] = None
    concept_id: Optional[str] = Field(None, alias="conceptId")
    description: Optional[str] = None
    is_step: bool = Field(alias="isStep")
    name: Optional[str] = None
    source_unit: Optional[str] = Field(None, alias="sourceUnit")
    standard_name: Optional[str] = Field(None, alias="standardName")
    type_: Literal["numeric", "string"] | str = Field(alias="type")

    def as_write(self) -> SensorTimeSeriesWrite:
        """Convert this read version of sensor time series to the writing version."""
        return SensorTimeSeriesWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of sensor time series to the writing version.

Source code in examples/wind_turbine/data_classes/_sensor_time_series.py
def as_write(self) -> SensorTimeSeriesWrite:
    """Convert this read version of sensor time series to the writing version."""
    return SensorTimeSeriesWrite.model_validate(as_write_args(self))

SensorTimeSeriesGraphQL

Bases: GraphQLCore

This represents the reading version of sensor time series, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the sensor time series.

required
data_record

The data record of the sensor time series node.

required
aliases

Alternative names for the node

required
concept_id

The concept ID of the time series.

required
description

Description of the instance

required
is_step

Specifies whether the time series is a step time series or not.

required
name

Name of the instance

required
source_unit

The unit specified in the source system.

required
standard_name

The standard name of the time series.

required
type_

Specifies the data type of the data points.

required
Source code in examples/wind_turbine/data_classes/_sensor_time_series.py
class SensorTimeSeriesGraphQL(GraphQLCore):
    """This represents the reading version of sensor time series, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the sensor time series.
        data_record: The data record of the sensor time series node.
        aliases: Alternative names for the node
        concept_id: The concept ID of the time series.
        description: Description of the instance
        is_step: Specifies whether the time series is a step time series or not.
        name: Name of the instance
        source_unit: The unit specified in the source system.
        standard_name: The standard name of the time series.
        type_: Specifies the data type of the data points.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "SensorTimeSeries", "1")
    aliases: Optional[list[str]] = None
    concept_id: Optional[str] = Field(None, alias="conceptId")
    description: Optional[str] = None
    is_step: Optional[bool] = Field(None, alias="isStep")
    name: Optional[str] = None
    source_unit: Optional[str] = Field(None, alias="sourceUnit")
    standard_name: Optional[str] = Field(None, alias="standardName")
    type_: Optional[Literal["numeric", "string"]] = Field(None, alias="type")

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    def as_read(self) -> SensorTimeSeries:
        """Convert this GraphQL format of sensor time series to the reading format."""
        return SensorTimeSeries.model_validate(as_read_args(self))

    def as_write(self) -> SensorTimeSeriesWrite:
        """Convert this GraphQL format of sensor time series to the writing format."""
        return SensorTimeSeriesWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of sensor time series to the reading format.

Source code in examples/wind_turbine/data_classes/_sensor_time_series.py
def as_read(self) -> SensorTimeSeries:
    """Convert this GraphQL format of sensor time series to the reading format."""
    return SensorTimeSeries.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of sensor time series to the writing format.

Source code in examples/wind_turbine/data_classes/_sensor_time_series.py
def as_write(self) -> SensorTimeSeriesWrite:
    """Convert this GraphQL format of sensor time series to the writing format."""
    return SensorTimeSeriesWrite.model_validate(as_write_args(self))

SensorTimeSeriesList

Bases: DomainModelList[SensorTimeSeries]

List of sensor time series in the read version.

Source code in examples/wind_turbine/data_classes/_sensor_time_series.py
class SensorTimeSeriesList(DomainModelList[SensorTimeSeries]):
    """List of sensor time series in the read version."""

    _INSTANCE = SensorTimeSeries

    def as_write(self) -> SensorTimeSeriesWriteList:
        """Convert these read versions of sensor time series to the writing versions."""
        return SensorTimeSeriesWriteList([node.as_write() for node in self.data])

as_write()

Convert these read versions of sensor time series to the writing versions.

Source code in examples/wind_turbine/data_classes/_sensor_time_series.py
def as_write(self) -> SensorTimeSeriesWriteList:
    """Convert these read versions of sensor time series to the writing versions."""
    return SensorTimeSeriesWriteList([node.as_write() for node in self.data])

SensorTimeSeriesWrite

Bases: DomainModelWrite

This represents the writing version of sensor time series.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the sensor time series.

required
data_record

The data record of the sensor time series node.

required
aliases

Alternative names for the node

required
concept_id

The concept ID of the time series.

required
description

Description of the instance

required
is_step

Specifies whether the time series is a step time series or not.

required
name

Name of the instance

required
source_unit

The unit specified in the source system.

required
standard_name

The standard name of the time series.

required
type_

Specifies the data type of the data points.

required
Source code in examples/wind_turbine/data_classes/_sensor_time_series.py
class SensorTimeSeriesWrite(DomainModelWrite):
    """This represents the writing version of sensor time series.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the sensor time series.
        data_record: The data record of the sensor time series node.
        aliases: Alternative names for the node
        concept_id: The concept ID of the time series.
        description: Description of the instance
        is_step: Specifies whether the time series is a step time series or not.
        name: Name of the instance
        source_unit: The unit specified in the source system.
        standard_name: The standard name of the time series.
        type_: Specifies the data type of the data points.
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "aliases",
        "concept_id",
        "description",
        "is_step",
        "name",
        "source_unit",
        "standard_name",
        "type_",
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "SensorTimeSeries", "1")

    space: str = DEFAULT_INSTANCE_SPACE
    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    aliases: Optional[list[str]] = None
    concept_id: Optional[str] = Field(None, alias="conceptId")
    description: Optional[str] = None
    is_step: bool = Field(alias="isStep")
    name: Optional[str] = None
    source_unit: Optional[str] = Field(None, alias="sourceUnit")
    standard_name: Optional[str] = Field(None, alias="standardName")
    type_: Literal["numeric", "string"] = Field(alias="type")

SensorTimeSeriesWriteList

Bases: DomainModelWriteList[SensorTimeSeriesWrite]

List of sensor time series in the writing version.

Source code in examples/wind_turbine/data_classes/_sensor_time_series.py
class SensorTimeSeriesWriteList(DomainModelWriteList[SensorTimeSeriesWrite]):
    """List of sensor time series in the writing version."""

    _INSTANCE = SensorTimeSeriesWrite

SolarPanel

Bases: GeneratingUnit

This represents the reading version of solar panel.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the solar panel.

required
data_record

The data record of the solar panel node.

required
capacity

The capacity field.

required
description

Description of the instance

required
efficiency

The efficiency field.

required
name

Name of the instance

required
orientation

The orientation field.

required
Source code in examples/wind_turbine/data_classes/_solar_panel.py
class SolarPanel(GeneratingUnit):
    """This represents the reading version of solar panel.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the solar panel.
        data_record: The data record of the solar panel node.
        capacity: The capacity field.
        description: Description of the instance
        efficiency: The efficiency field.
        name: Name of the instance
        orientation: The orientation field.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "SolarPanel", "1")

    node_type: Union[dm.DirectRelationReference, None] = None
    efficiency: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)
    orientation: Union[SensorTimeSeries, str, dm.NodeId, None] = Field(default=None, repr=False)

    @field_validator("efficiency", "orientation", mode="before")
    @classmethod
    def parse_single(cls, value: Any, info: ValidationInfo) -> Any:
        return parse_single_connection(value, info.field_name)

    def as_write(self) -> SolarPanelWrite:
        """Convert this read version of solar panel to the writing version."""
        return SolarPanelWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of solar panel to the writing version.

Source code in examples/wind_turbine/data_classes/_solar_panel.py
def as_write(self) -> SolarPanelWrite:
    """Convert this read version of solar panel to the writing version."""
    return SolarPanelWrite.model_validate(as_write_args(self))

SolarPanelGraphQL

Bases: GraphQLCore

This represents the reading version of solar panel, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the solar panel.

required
data_record

The data record of the solar panel node.

required
capacity

The capacity field.

required
description

Description of the instance

required
efficiency

The efficiency field.

required
name

Name of the instance

required
orientation

The orientation field.

required
Source code in examples/wind_turbine/data_classes/_solar_panel.py
class SolarPanelGraphQL(GraphQLCore):
    """This represents the reading version of solar panel, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the solar panel.
        data_record: The data record of the solar panel node.
        capacity: The capacity field.
        description: Description of the instance
        efficiency: The efficiency field.
        name: Name of the instance
        orientation: The orientation field.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "SolarPanel", "1")
    capacity: Optional[float] = None
    description: Optional[str] = None
    efficiency: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)
    name: Optional[str] = None
    orientation: Optional[SensorTimeSeriesGraphQL] = Field(default=None, repr=False)

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    @field_validator("efficiency", "orientation", mode="before")
    def parse_graphql(cls, value: Any) -> Any:
        if not isinstance(value, dict):
            return value
        if "items" in value:
            return value["items"]
        return value

    def as_read(self) -> SolarPanel:
        """Convert this GraphQL format of solar panel to the reading format."""
        return SolarPanel.model_validate(as_read_args(self))

    def as_write(self) -> SolarPanelWrite:
        """Convert this GraphQL format of solar panel to the writing format."""
        return SolarPanelWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of solar panel to the reading format.

Source code in examples/wind_turbine/data_classes/_solar_panel.py
def as_read(self) -> SolarPanel:
    """Convert this GraphQL format of solar panel to the reading format."""
    return SolarPanel.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of solar panel to the writing format.

Source code in examples/wind_turbine/data_classes/_solar_panel.py
def as_write(self) -> SolarPanelWrite:
    """Convert this GraphQL format of solar panel to the writing format."""
    return SolarPanelWrite.model_validate(as_write_args(self))

SolarPanelList

Bases: DomainModelList[SolarPanel]

List of solar panels in the read version.

Source code in examples/wind_turbine/data_classes/_solar_panel.py
class SolarPanelList(DomainModelList[SolarPanel]):
    """List of solar panels in the read version."""

    _INSTANCE = SolarPanel

    def as_write(self) -> SolarPanelWriteList:
        """Convert these read versions of solar panel to the writing versions."""
        return SolarPanelWriteList([node.as_write() for node in self.data])

    @property
    def efficiency(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.efficiency for item in self.data if isinstance(item.efficiency, SensorTimeSeries)]
        )

    @property
    def orientation(self) -> SensorTimeSeriesList:
        from ._sensor_time_series import SensorTimeSeries, SensorTimeSeriesList

        return SensorTimeSeriesList(
            [item.orientation for item in self.data if isinstance(item.orientation, SensorTimeSeries)]
        )

as_write()

Convert these read versions of solar panel to the writing versions.

Source code in examples/wind_turbine/data_classes/_solar_panel.py
def as_write(self) -> SolarPanelWriteList:
    """Convert these read versions of solar panel to the writing versions."""
    return SolarPanelWriteList([node.as_write() for node in self.data])

SolarPanelWrite

Bases: GeneratingUnitWrite

This represents the writing version of solar panel.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the solar panel.

required
data_record

The data record of the solar panel node.

required
capacity

The capacity field.

required
description

Description of the instance

required
efficiency

The efficiency field.

required
name

Name of the instance

required
orientation

The orientation field.

required
Source code in examples/wind_turbine/data_classes/_solar_panel.py
class SolarPanelWrite(GeneratingUnitWrite):
    """This represents the writing version of solar panel.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the solar panel.
        data_record: The data record of the solar panel node.
        capacity: The capacity field.
        description: Description of the instance
        efficiency: The efficiency field.
        name: Name of the instance
        orientation: The orientation field.
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "capacity",
        "description",
        "efficiency",
        "name",
        "orientation",
    )
    _direct_relations: ClassVar[tuple[str, ...]] = (
        "efficiency",
        "orientation",
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "SolarPanel", "1")

    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    efficiency: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    orientation: Union[SensorTimeSeriesWrite, str, dm.NodeId, None] = Field(default=None, repr=False)

    @field_validator("efficiency", "orientation", mode="before")
    def as_node_id(cls, value: Any) -> Any:
        if isinstance(value, dm.DirectRelationReference):
            return dm.NodeId(value.space, value.external_id)
        elif isinstance(value, tuple) and len(value) == 2 and all(isinstance(item, str) for item in value):
            return dm.NodeId(value[0], value[1])
        elif isinstance(value, list):
            return [cls.as_node_id(item) for item in value]
        return value

SolarPanelWriteList

Bases: DomainModelWriteList[SolarPanelWrite]

List of solar panels in the writing version.

Source code in examples/wind_turbine/data_classes/_solar_panel.py
class SolarPanelWriteList(DomainModelWriteList[SolarPanelWrite]):
    """List of solar panels in the writing version."""

    _INSTANCE = SolarPanelWrite

    @property
    def efficiency(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [item.efficiency for item in self.data if isinstance(item.efficiency, SensorTimeSeriesWrite)]
        )

    @property
    def orientation(self) -> SensorTimeSeriesWriteList:
        from ._sensor_time_series import SensorTimeSeriesWrite, SensorTimeSeriesWriteList

        return SensorTimeSeriesWriteList(
            [item.orientation for item in self.data if isinstance(item.orientation, SensorTimeSeriesWrite)]
        )

WindTurbine

Bases: GeneratingUnit

This represents the reading version of wind turbine.

It is used to when data is retrieved from CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the wind turbine.

required
data_record

The data record of the wind turbine node.

required
blades

The blade field.

required
capacity

The capacity field.

required
datasheets

The datasheet field.

required
description

Description of the instance

required
metmast

The metmast field.

required
nacelle

The nacelle field.

required
name

Name of the instance

required
power_curve

The power curve field.

required
rotor

The rotor field.

required
windfarm

The windfarm field.

required
Source code in examples/wind_turbine/data_classes/_wind_turbine.py
class WindTurbine(GeneratingUnit):
    """This represents the reading version of wind turbine.

    It is used to when data is retrieved from CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the wind turbine.
        data_record: The data record of the wind turbine node.
        blades: The blade field.
        capacity: The capacity field.
        datasheets: The datasheet field.
        description: Description of the instance
        metmast: The metmast field.
        nacelle: The nacelle field.
        name: Name of the instance
        power_curve: The power curve field.
        rotor: The rotor field.
        windfarm: The windfarm field.
    """

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "WindTurbine", "1")

    node_type: Union[dm.DirectRelationReference, None] = None
    blades: Optional[list[Union[Blade, str, dm.NodeId]]] = Field(default=None, repr=False)
    datasheets: Optional[list[Union[DataSheet, str, dm.NodeId]]] = Field(default=None, repr=False)
    metmast: Optional[list[Distance]] = Field(default=None, repr=False)
    nacelle: Union[Nacelle, str, dm.NodeId, None] = Field(default=None, repr=False)
    power_curve: Union[SequenceRead, str, None] = Field(None, alias="powerCurve")
    rotor: Union[Rotor, str, dm.NodeId, None] = Field(default=None, repr=False)
    windfarm: Optional[str] = None

    @field_validator("nacelle", "rotor", mode="before")
    @classmethod
    def parse_single(cls, value: Any, info: ValidationInfo) -> Any:
        return parse_single_connection(value, info.field_name)

    @field_validator("blades", "datasheets", "metmast", mode="before")
    @classmethod
    def parse_list(cls, value: Any, info: ValidationInfo) -> Any:
        if value is None:
            return None
        return [parse_single_connection(item, info.field_name) for item in value]

    def as_write(self) -> WindTurbineWrite:
        """Convert this read version of wind turbine to the writing version."""
        return WindTurbineWrite.model_validate(as_write_args(self))

as_write()

Convert this read version of wind turbine to the writing version.

Source code in examples/wind_turbine/data_classes/_wind_turbine.py
def as_write(self) -> WindTurbineWrite:
    """Convert this read version of wind turbine to the writing version."""
    return WindTurbineWrite.model_validate(as_write_args(self))

WindTurbineGraphQL

Bases: GraphQLCore

This represents the reading version of wind turbine, used when data is retrieved from CDF using GraphQL.

It is used when retrieving data from CDF using GraphQL.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the wind turbine.

required
data_record

The data record of the wind turbine node.

required
blades

The blade field.

required
capacity

The capacity field.

required
datasheets

The datasheet field.

required
description

Description of the instance

required
metmast

The metmast field.

required
nacelle

The nacelle field.

required
name

Name of the instance

required
power_curve

The power curve field.

required
rotor

The rotor field.

required
windfarm

The windfarm field.

required
Source code in examples/wind_turbine/data_classes/_wind_turbine.py
class WindTurbineGraphQL(GraphQLCore):
    """This represents the reading version of wind turbine, used
    when data is retrieved from CDF using GraphQL.

    It is used when retrieving data from CDF using GraphQL.

    Args:
        space: The space where the node is located.
        external_id: The external id of the wind turbine.
        data_record: The data record of the wind turbine node.
        blades: The blade field.
        capacity: The capacity field.
        datasheets: The datasheet field.
        description: Description of the instance
        metmast: The metmast field.
        nacelle: The nacelle field.
        name: Name of the instance
        power_curve: The power curve field.
        rotor: The rotor field.
        windfarm: The windfarm field.
    """

    view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "WindTurbine", "1")
    blades: Optional[list[BladeGraphQL]] = Field(default=None, repr=False)
    capacity: Optional[float] = None
    datasheets: Optional[list[DataSheetGraphQL]] = Field(default=None, repr=False)
    description: Optional[str] = None
    metmast: Optional[list[DistanceGraphQL]] = Field(default=None, repr=False)
    nacelle: Optional[NacelleGraphQL] = Field(default=None, repr=False)
    name: Optional[str] = None
    power_curve: Optional[SequenceGraphQL] = Field(None, alias="powerCurve")
    rotor: Optional[RotorGraphQL] = Field(default=None, repr=False)
    windfarm: Optional[str] = None

    @model_validator(mode="before")
    def parse_data_record(cls, values: Any) -> Any:
        if not isinstance(values, dict):
            return values
        if "lastUpdatedTime" in values or "createdTime" in values:
            values["dataRecord"] = DataRecordGraphQL(
                created_time=values.pop("createdTime", None),
                last_updated_time=values.pop("lastUpdatedTime", None),
            )
        return values

    @field_validator("blades", "datasheets", "metmast", "nacelle", "rotor", mode="before")
    def parse_graphql(cls, value: Any) -> Any:
        if not isinstance(value, dict):
            return value
        if "items" in value:
            return value["items"]
        return value

    def as_read(self) -> WindTurbine:
        """Convert this GraphQL format of wind turbine to the reading format."""
        return WindTurbine.model_validate(as_read_args(self))

    def as_write(self) -> WindTurbineWrite:
        """Convert this GraphQL format of wind turbine to the writing format."""
        return WindTurbineWrite.model_validate(as_write_args(self))

as_read()

Convert this GraphQL format of wind turbine to the reading format.

Source code in examples/wind_turbine/data_classes/_wind_turbine.py
def as_read(self) -> WindTurbine:
    """Convert this GraphQL format of wind turbine to the reading format."""
    return WindTurbine.model_validate(as_read_args(self))

as_write()

Convert this GraphQL format of wind turbine to the writing format.

Source code in examples/wind_turbine/data_classes/_wind_turbine.py
def as_write(self) -> WindTurbineWrite:
    """Convert this GraphQL format of wind turbine to the writing format."""
    return WindTurbineWrite.model_validate(as_write_args(self))

WindTurbineList

Bases: DomainModelList[WindTurbine]

List of wind turbines in the read version.

Source code in examples/wind_turbine/data_classes/_wind_turbine.py
class WindTurbineList(DomainModelList[WindTurbine]):
    """List of wind turbines in the read version."""

    _INSTANCE = WindTurbine

    def as_write(self) -> WindTurbineWriteList:
        """Convert these read versions of wind turbine to the writing versions."""
        return WindTurbineWriteList([node.as_write() for node in self.data])

    @property
    def blades(self) -> BladeList:
        from ._blade import Blade, BladeList

        return BladeList([item for items in self.data for item in items.blades or [] if isinstance(item, Blade)])

    @property
    def datasheets(self) -> DataSheetList:
        from ._data_sheet import DataSheet, DataSheetList

        return DataSheetList(
            [item for items in self.data for item in items.datasheets or [] if isinstance(item, DataSheet)]
        )

    @property
    def metmast(self) -> DistanceList:
        from ._distance import Distance, DistanceList

        return DistanceList([item for items in self.data for item in items.metmast or [] if isinstance(item, Distance)])

    @property
    def nacelle(self) -> NacelleList:
        from ._nacelle import Nacelle, NacelleList

        return NacelleList([item.nacelle for item in self.data if isinstance(item.nacelle, Nacelle)])

    @property
    def rotor(self) -> RotorList:
        from ._rotor import Rotor, RotorList

        return RotorList([item.rotor for item in self.data if isinstance(item.rotor, Rotor)])

as_write()

Convert these read versions of wind turbine to the writing versions.

Source code in examples/wind_turbine/data_classes/_wind_turbine.py
def as_write(self) -> WindTurbineWriteList:
    """Convert these read versions of wind turbine to the writing versions."""
    return WindTurbineWriteList([node.as_write() for node in self.data])

WindTurbineWrite

Bases: GeneratingUnitWrite

This represents the writing version of wind turbine.

It is used to when data is sent to CDF.

Parameters:

Name Type Description Default
space

The space where the node is located.

required
external_id

The external id of the wind turbine.

required
data_record

The data record of the wind turbine node.

required
blades

The blade field.

required
capacity

The capacity field.

required
datasheets

The datasheet field.

required
description

Description of the instance

required
metmast

The metmast field.

required
nacelle

The nacelle field.

required
name

Name of the instance

required
power_curve

The power curve field.

required
rotor

The rotor field.

required
windfarm

The windfarm field.

required
Source code in examples/wind_turbine/data_classes/_wind_turbine.py
class WindTurbineWrite(GeneratingUnitWrite):
    """This represents the writing version of wind turbine.

    It is used to when data is sent to CDF.

    Args:
        space: The space where the node is located.
        external_id: The external id of the wind turbine.
        data_record: The data record of the wind turbine node.
        blades: The blade field.
        capacity: The capacity field.
        datasheets: The datasheet field.
        description: Description of the instance
        metmast: The metmast field.
        nacelle: The nacelle field.
        name: Name of the instance
        power_curve: The power curve field.
        rotor: The rotor field.
        windfarm: The windfarm field.
    """

    _container_fields: ClassVar[tuple[str, ...]] = (
        "blades",
        "capacity",
        "datasheets",
        "description",
        "nacelle",
        "name",
        "power_curve",
        "rotor",
        "windfarm",
    )
    _outwards_edges: ClassVar[tuple[tuple[str, dm.DirectRelationReference], ...]] = (
        ("metmast", dm.DirectRelationReference("sp_pygen_power_enterprise", "Distance")),
    )
    _direct_relations: ClassVar[tuple[str, ...]] = (
        "blades",
        "datasheets",
        "nacelle",
        "rotor",
    )

    _view_id: ClassVar[dm.ViewId] = dm.ViewId("sp_pygen_power", "WindTurbine", "1")

    node_type: Union[dm.DirectRelationReference, dm.NodeId, tuple[str, str], None] = None
    blades: Optional[list[Union[BladeWrite, str, dm.NodeId]]] = Field(default=None, repr=False)
    datasheets: Optional[list[Union[DataSheetWrite, str, dm.NodeId]]] = Field(default=None, repr=False)
    metmast: Optional[list[DistanceWrite]] = Field(default=None, repr=False)
    nacelle: Union[NacelleWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    power_curve: Union[SequenceWrite, str, None] = Field(None, alias="powerCurve")
    rotor: Union[RotorWrite, str, dm.NodeId, None] = Field(default=None, repr=False)
    windfarm: Optional[str] = None

    @field_validator("blades", "datasheets", "metmast", "nacelle", "rotor", mode="before")
    def as_node_id(cls, value: Any) -> Any:
        if isinstance(value, dm.DirectRelationReference):
            return dm.NodeId(value.space, value.external_id)
        elif isinstance(value, tuple) and len(value) == 2 and all(isinstance(item, str) for item in value):
            return dm.NodeId(value[0], value[1])
        elif isinstance(value, list):
            return [cls.as_node_id(item) for item in value]
        return value

WindTurbineWriteList

Bases: DomainModelWriteList[WindTurbineWrite]

List of wind turbines in the writing version.

Source code in examples/wind_turbine/data_classes/_wind_turbine.py
class WindTurbineWriteList(DomainModelWriteList[WindTurbineWrite]):
    """List of wind turbines in the writing version."""

    _INSTANCE = WindTurbineWrite

    @property
    def blades(self) -> BladeWriteList:
        from ._blade import BladeWrite, BladeWriteList

        return BladeWriteList(
            [item for items in self.data for item in items.blades or [] if isinstance(item, BladeWrite)]
        )

    @property
    def datasheets(self) -> DataSheetWriteList:
        from ._data_sheet import DataSheetWrite, DataSheetWriteList

        return DataSheetWriteList(
            [item for items in self.data for item in items.datasheets or [] if isinstance(item, DataSheetWrite)]
        )

    @property
    def metmast(self) -> DistanceWriteList:
        from ._distance import DistanceWrite, DistanceWriteList

        return DistanceWriteList(
            [item for items in self.data for item in items.metmast or [] if isinstance(item, DistanceWrite)]
        )

    @property
    def nacelle(self) -> NacelleWriteList:
        from ._nacelle import NacelleWrite, NacelleWriteList

        return NacelleWriteList([item.nacelle for item in self.data if isinstance(item.nacelle, NacelleWrite)])

    @property
    def rotor(self) -> RotorWriteList:
        from ._rotor import RotorWrite, RotorWriteList

        return RotorWriteList([item.rotor for item in self.data if isinstance(item.rotor, RotorWrite)])