Skip to content

Commit c63e794

Browse files
committed
update line lengths
1 parent 870402d commit c63e794

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

pvlib/iotools/pan_binary.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
"""
2-
Older versions of PAN files created by PVsyst use a Borland Pascal Real48 format.
2+
Older versions of PAN files created by PVsyst use a Borland Pascal Real48
3+
format.
34
45
This is based on:
5-
https://github.com/CanadianSolar/CASSYS/blob/b5487bb4e9e77174c805d64e3c960c46d357b7e2/CASSYS%20Interface/DatabaseImportModule.vba#L4
6+
https://github.com/CanadianSolar/CASSYS/blob/
7+
b5487bb4e9e77174c805d64e3c960c46d357b7e2/CASSYS%20Interface/
8+
DatabaseImportModule.vba#L4
69
"""
710

811
import struct
@@ -131,7 +134,8 @@ def _extract_byte_parameters(byte_array, start_index, num_bytes):
131134
# Check bounds to avoid index errors
132135
if start_index + num_bytes > len(byte_array):
133136
raise IndexError(
134-
f"Not enough bytes: need {num_bytes} bytes starting at {start_index}"
137+
f"Not enough bytes: need {num_bytes} bytes starting at "
138+
f"{start_index}"
135139
)
136140

137141
# Extract the specified number of bytes starting at start_index
@@ -174,7 +178,9 @@ def _extract_iam_profile(start_index, byte_array):
174178
# Check if AOI is not null/empty (like VB.NET vbNullString check)
175179
if aoi_formatted != "":
176180
# Extract modifier value
177-
modifier_index = _get_param_index(start_index=start_index, offset_num=i + 1)
181+
modifier_index = _get_param_index(
182+
start_index=start_index, offset_num=i + 1
183+
)
178184
modifier_bytes = _extract_byte_parameters(
179185
byte_array=byte_array, start_index=modifier_index, num_bytes=6
180186
)
@@ -230,7 +236,9 @@ def read_pan_binary(filename):
230236
marker=DOT_MARKER, start_index=0, byte_array=byte_array
231237
)
232238
source_start_index = _find_marker_index(
233-
marker=DOT_MARKER, start_index=panel_start_index, byte_array=byte_array
239+
marker=DOT_MARKER,
240+
start_index=panel_start_index,
241+
byte_array=byte_array
234242
)
235243
version_start_index = _find_marker_index(
236244
marker=DOUBLE_DOT_MARKER,
@@ -310,17 +318,23 @@ def read_pan_binary(filename):
310318
.strip()
311319
)
312320
data["Technology"] = (
313-
byte_array[technology_start_index : cells_in_series_start_index - 1]
321+
byte_array[
322+
technology_start_index : cells_in_series_start_index - 1
323+
]
314324
.decode("latin-1")
315325
.strip()
316326
)
317327
data["Cells_In_Series"] = (
318-
byte_array[cells_in_series_start_index : cells_in_parallel_start_index - 1]
328+
byte_array[
329+
cells_in_series_start_index : cells_in_parallel_start_index - 1
330+
]
319331
.decode("latin-1")
320332
.strip()
321333
)
322334
data["Cells_In_Parallel"] = (
323-
byte_array[cells_in_parallel_start_index : bypass_diodes_start_index - 1]
335+
byte_array[
336+
cells_in_parallel_start_index : bypass_diodes_start_index - 1
337+
]
324338
.decode("latin-1")
325339
.strip()
326340
)
@@ -349,7 +363,9 @@ def read_pan_binary(filename):
349363
}
350364

351365
for name, offset in param_map.items():
352-
start = _get_param_index(start_index=real48_start_index, offset_num=offset)
366+
start = _get_param_index(
367+
start_index=real48_start_index, offset_num=offset
368+
)
353369
end = start + 6
354370
param_bytes = byte_array[start:end]
355371
value = _read48_to_float(real48=param_bytes)

0 commit comments

Comments
 (0)