Multiply sequence error with Pypsa-eur-sec

51 views
Skip to first unread message

Marc Keller

unread,
Jul 12, 2022, 10:28:09 AM7/12/22
to pypsa
Hi there,

thank you very much for the really nice software, work and documentation!

I've worked with PyPSA-eur and after a while I got used to it and could fix and change minor issues. At the moment I'm trying to run PyPSA-eur-sec as the tutorial recommended and I'm running into a problem for the build_biomass_potential rule. My first thought was to disable the rule in the snakemake process and it worked and the model could solve it. Unfortunatly I had issues with the make_summary rule, because of the missing biomass_potential. So I'm trying to fix that directly now.

If I'm trying to run the build_biomass_potential rule, I always get the same error (screenshot):

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

Does anyone of you maybe know how to fix it? A new installation unforunatly didn't help.

I only changed some folder dependecies, because for me it didn't work with "jrc_dir" or "eurostat_dir". If I put the path directly into the script, it wasn't a problem.

Thank you very much,
Marc
Bildschirmfoto 2022-07-12 um 16.27.13.png

Fabian Neumann

unread,
Jul 12, 2022, 2:37:04 PM7/12/22
to py...@googlegroups.com
Hi Marc,

this error is not known to me, but I can give it a try to reproduce this
error next week.

If anyone else wants to have a shot in the meantime, that's also great!

Best wishes,

Fabian
> --
> You received this message because you are subscribed to the Google
> Groups "pypsa" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to pypsa+un...@googlegroups.com
> <mailto:pypsa+un...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/pypsa/6b4b879e-8b71-493e-8d7b-02bf96ba403en%40googlegroups.com
> <https://groups.google.com/d/msgid/pypsa/6b4b879e-8b71-493e-8d7b-02bf96ba403en%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Dr.-Ing.
Fabian Neumann (he/him)
Postdoctoral Researcher

Department of Digital Transformation in Energy Systems
Institute of Energy Technology
Technische Universität Berlin

Group website: https://tub-ensys.github.io
Personal website: https://neumann.fyi
Schedule Meeting: https://calendly.com/fneum

Einsteinufer 25 (TA 8)
10587 Berlin

My working hours may not be your working hours. Do not feel pressure to
reply to this email outside your working hours.

Marc Keller

unread,
Jul 14, 2022, 4:46:07 AM7/14/22
to pypsa
Hi Fabian,

thank you very much! I tried it again and this error happens to me, if I just run the basic tutorial from scratch.

Does anyone maybe have these two files for me and can maybe upload or send it? I'm also happy, if you work with another number of nodes. I just would like to continue working with PyPSA-eur-sec, because I couldn't fix the problem by now. Anything between 37 and 100 ist totally fine.

resources/biomass_potentials_all_s_50.csv,
resources/biomass_potentials_s_50.csv

Thanks and best regards,
Marc

Paul Reggentin

unread,
Jul 14, 2022, 8:44:02 AM7/14/22
to pypsa
I'm having the same problem, looking at it now. In the meantime, here are the files you need.
Paul
biomass_potentials_s_45.csv
biomass_potentials_all_s_45.csv

Paul Reggentin

unread,
Jul 14, 2022, 9:22:11 AM7/14/22
to pypsa
Here is the source of the problem:

In build_biomass_potentials.py, line 186 there is one columns name left out. Add "country" to the list of columns sent to the difference() method, so it looks as follows:

adjust_cols = overlay.columns.difference({"name", "area_nuts2", "geometry", "share","country"})

the problem is, that if the "country" column stays in the adjust_cols series, in line 187 it will try to multiply the floats in column "share" by the strings of country names.

Hopefully this works!
Paul

Marc Keller

unread,
Jul 14, 2022, 11:33:43 AM7/14/22
to pypsa
Hey Paul,

that solved the problem, thank you very much!

Best regards
Marc

Neumann, Fabian

unread,
Jul 17, 2022, 12:27:13 PM7/17/22
to Marc Keller, pypsa
I’ll tackle the issue in the upcoming week with the solution discussed on the list.

Just be aware in the meantime, that depending on config settings and versions two runs clustered to the same number of nodes may not lead to the same clustering.

Best wishes,

Fabian N

On 14 Jul 2022, at 10:46, 'Marc Keller' via pypsa <py...@googlegroups.com> wrote:


To unsubscribe from this group and stop receiving emails from it, send an email to pypsa+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pypsa/1c927b2a-5089-458f-b171-fd8f2ea9542cn%40googlegroups.com.

Fabian Neumann

unread,
Jul 18, 2022, 12:27:57 PM7/18/22
to Paul Reggentin, pypsa, Glaum, Philipp
Hi all,

the solution is almost correct. Unintentionally, the simplified and
clustered region shapes recently got the additional columns "x", "y" and
"countries" without apparent use. You solution is only almost correct
because the "x" and "y" would still be included in the sum and distort
the potentials. The correct set would be {"name", ..., "country", "x", y"}.

But I decided to fix this issue further upstream in PyPSA-Eur, by
dropping the additional unused columns:

https://github.com/PyPSA/pypsa-eur/pull/395

A pull of the PyPSA-Eur master branch will fix your issues.

Best wishes,

Fabian N

On 14.07.22 15:22, Paul Reggentin wrote:
> Here is the source of the problem:
>
> In*build_biomass_potentials.py, line 186 *there is one columns name left
> out. Add "country" to the list of columns sent to the *difference()*
> <https://groups.google.com/d/msgid/pypsa/6b4b879e-8b71-493e-8d7b-02bf96ba403en%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/pypsa/6b4b879e-8b71-493e-8d7b-02bf96ba403en%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
> --
> Dr.-Ing.
> Fabian Neumann (he/him)
> Postdoctoral Researcher
>
> Department of Digital Transformation in Energy Systems
> Institute of Energy Technology
> Technische Universität Berlin
>
> Group website: https://tub-ensys.github.io
> <https://tub-ensys.github.io>
> Personal website: https://neumann.fyi <https://neumann.fyi>
> Schedule Meeting: https://calendly.com/fneum
> <https://calendly.com/fneum>
>
> Einsteinufer 25 (TA 8)
> 10587 Berlin
>
> My working hours may not be your working hours. Do not feel
> pressure to
> reply to this email outside your working hours.
>
> --
> You received this message because you are subscribed to the Google
> Groups "pypsa" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to pypsa+un...@googlegroups.com
> <mailto:pypsa+un...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/pypsa/b0885b6a-3039-4ec6-8778-91d7499612e6n%40googlegroups.com
> <https://groups.google.com/d/msgid/pypsa/b0885b6a-3039-4ec6-8778-91d7499612e6n%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages