GHI to POA Transposition

Skip to first unread message

Lorenzo Petrini

May 7, 2024, 6:32:14 AMMay 7
to pvlib-python
Dear pvlib community,

I'm trying to convert a GHI into POA using the code in the link:

But I don't want to use GHI from a database, I want to use the GHI I measured in the site. But when I try to substitute the part of the code where it is defined the ghi variable:

ghi=clearsky['ghi']      with a vector (or list, I don't know yet the terms of phyton, I apologize for that) containing the values of GHI measured (each 1 min, for 24 hour) and I run the code, I got the following error:

TypeError: can't multiply sequence by non-int of type 'float'

Someone has already done this succesfully?

Thank you in advance for helping,

Kind Regards
Lorenzo Petrini

PS: the whole output is 

runfile('C:/Users/A474229/OneDrive - Enel Spa/Desktop/Sedeis', wdir='C:/Users/A474229/OneDrive - Enel Spa/Desktop')
Traceback (most recent call last):

  File ~\AppData\Local\anaconda3\Lib\site-packages\spyder_kernels\ in compat_exec
    exec(code, globals, locals)

  File c:\users\a474229\onedrive - enel spa\desktop\sedeis
    summer_irradiance = get_irradiance(site, '04-21-2024', 30, 180)

  File c:\users\a474229\onedrive - enel spa\desktop\sedeis in get_irradiance
    POA_irradiance = irradiance.get_total_irradiance(

  File ~\AppData\Local\anaconda3\Lib\site-packages\pvlib\ in get_total_irradiance
    poa_ground_diffuse = get_ground_diffuse(surface_tilt, ghi, albedo,

  File ~\AppData\Local\anaconda3\Lib\site-packages\pvlib\ in get_ground_diffuse
    diffuse_irrad = ghi * albedo * (1 - np.cos(np.radians(surface_tilt))) * 0.5

TypeError: can't multiply sequence by non-int of type 'float'

Abed W Ayyad

May 7, 2024, 3:19:16 PMMay 7
to Lorenzo Petrini, pvlib-python

You received this message because you are subscribed to the Google Groups "pvlib-python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Echedey Luis Álvarez

May 7, 2024, 3:19:21 PMMay 7

Hi Lorenzo,

Everything in Python is an object, and it is up to each of them how to implement arithmetic operations.

If you run [1, 2, 3] * 1.5 you will get the same error. This is because a list (the first item) doesn't implement multiplication by non ints (the second item is a float). If you multiply by an int you will get another type of result: you can try running [1,2,3]*2 on the python console and checking the output.

Now, what you have to do is exactly what you expect: you need an object that defines the element-wise multiplication. For this kind of use, we usually either use numpy.ndarray or pandas.Series objects (there are other alternatives too).

Possibilities to convert a Python list into an array are:

I heavily recommend you check out their docs, reading documentation in Python is a key part in the development.

I don't really know where are you getting the data from, but pandas has an extensive API of readers: CSV files, JSON, ... Just in case it can help you.


Reply all
Reply to author
Message has been deleted
0 new messages