@@ -493,8 +493,12 @@ def __init__(
493
493
494
494
if not units is None :
495
495
self .units = str (units )
496
+
496
497
if not process is None :
497
498
self .process = str (process )
499
+ else :
500
+ self .process = CR1000XField ._get_process (name )
501
+
498
502
if settable is not None :
499
503
if not isinstance (settable , bool ):
500
504
raise TypeError (
@@ -551,8 +555,7 @@ def _get_avg_xsd_type(values: list) -> XMLDataTypes:
551
555
552
556
Args:
553
557
values: The list of values to assess.
554
- Returns:
555
- XMLDataType: The resultant type."""
558
+ Returns: The resultant type."""
556
559
557
560
if not hasattr (values , "__iter__" ):
558
561
values = [values ]
@@ -572,8 +575,7 @@ def _get_xsd_type(value: str | int | float | bool | object) -> XMLDataTypes:
572
575
Args:
573
576
value: The item to convert.
574
577
575
- Returns:
576
- XMLDataTypes: The XML datatype.
578
+ Returns: The XML datatype.
577
579
"""
578
580
if value is None :
579
581
return XMLDataTypes .null
@@ -624,3 +626,32 @@ def _get_xsd_type(value: str | int | float | bool | object) -> XMLDataTypes:
624
626
raise TypeError (
625
627
f"Couldnt find XML datatype for value `{ value } ` and type: `{ type (value )} `."
626
628
)
629
+
630
+ @staticmethod
631
+ def _get_process (value : str ) -> str :
632
+ """Calculates the process attribute based on the variable name.
633
+
634
+ Args:
635
+ value: The variable name to generate from.
636
+
637
+ Returns: The value of the expected process used.
638
+ """
639
+
640
+ value = value .lower ()
641
+
642
+ if value .endswith ("_std" ): # Standard Deviation
643
+ return "Std"
644
+ elif value .endswith ("_avg" ): # Average
645
+ return "Avg"
646
+ elif value .endswith ("_max" ): # Maximum
647
+ return "Max"
648
+ elif value .endswith ("_min" ): # Minimum
649
+ return "Min"
650
+ elif value .endswith ("_mom" ): # Moment
651
+ return "Mom"
652
+ elif value .endswith ("_tot" ): # Totalize
653
+ return "Tot"
654
+ elif value .endswith ("_cov" ): # Covariance
655
+ return "Cov"
656
+
657
+ return "Smp" # Sample
0 commit comments