Help me about " invalid value encountered in double_scalars "

1,291 views
Skip to first unread message

Tuyến Nguyễn

unread,
Mar 22, 2018, 6:59:20 AM3/22/18
to pypsa
C:\Users\PC\Anaconda3\envs\PyPSA\lib\site-packages\ipykernel_launcher.py:20: RuntimeWarning:

invalid value encountered in double_scalars

C:\Users\PC\Anaconda3\envs\PyPSA\lib\site-packages\ipykernel_launcher.py:21: RuntimeWarning:

invalid value encountered in double_scalars

C:\Users\PC\Anaconda3\envs\PyPSA\lib\site-packages\ipykernel_launcher.py:22: RuntimeWarning:

invalid value encountered in double_scalars

C:\Users\PC\Anaconda3\envs\PyPSA\lib\site-packages\ipykernel_launcher.py:23: RuntimeWarning:

invalid value encountered in double_scalars

ValueErrorTraceback (most recent call last)
<ipython-input-75-8b60cdc20b06> in <module>()
     22                     network.generators_t.p[node+' solar'].sum()/gen[node],
     23                      network.generators_t.p[node+' hydro'].sum()/gen[node]],
---> 24              size=2.5*gen[node]/overall_gen)
     25 
     26 #plt.savefig('gen_distr.pdf')

<ipython-input-74-896d2eb2da0a> in draw_pie(ax, pieces, X, Y, size, colors, alpha, zorder)
     11 
     12         #http://matplotlib.org/examples/api/patch_collection.html
---> 13         wedge = Wedge((X, Y), radius, 360*start, 360*(start+ratio), facecolor=colors[i],alpha=alpha,zorder=zorder)
     14 
     15         ax.add_patch(wedge)

C:\Users\PC\Anaconda3\envs\PyPSA\lib\site-packages\matplotlib\patches.pyc in __init__(self, center, r, theta1, theta2, width, **kwargs)
   1031         self.theta1, self.theta2 = theta1, theta2
   1032         self._patch_transform = transforms.IdentityTransform()
-> 1033         self._recompute_path()
   1034 
   1035     def _recompute_path(self):

C:\Users\PC\Anaconda3\envs\PyPSA\lib\site-packages\matplotlib\patches.pyc in _recompute_path(self)
   1043 
   1044         # Form the outer ring
-> 1045         arc = Path.arc(theta1, theta2)
   1046 
   1047         if self.width is not None:

C:\Users\PC\Anaconda3\envs\PyPSA\lib\site-packages\matplotlib\path.pyc in arc(cls, theta1, theta2, n, is_wedge)
    878         # number of curve segments to make
    879         if n is None:
--> 880             n = int(2 ** np.ceil((eta2 - eta1) / halfpi))
    881         if n < 1:
    882             raise ValueError("n must be >= 1 or None")

ValueError: cannot convert float NaN to integer

Tom Brown

unread,
Mar 22, 2018, 12:48:03 PM3/22/18
to py...@googlegroups.com
When posting errors, please post a minimal working example that
reproduces the error, rather than just posting the error message without
any context.

Please also try to debug the error yourself first: the error message is
complaining about NaNs. Please check your data for NaNs, e.g. in
"gen[node]" or "overall_gen".

Bare in mind that although we would never claim to right bug-free code,
90% of errors registered on this forum are because of faulty input data.
We are still grateful for error reporting to isolate the other 10% that
are to do with genuine issues in PyPSA :-).

Best,

Tom




On 22/03/18 11:59, Tuyến Nguyễn wrote:
> C:\Users\PC\Anaconda3\envs\PyPSA\lib\site-packages\ipykernel_launcher.py:20: RuntimeWarning:
>
> invalid value encountered in double_scalars
>
> C:\Users\PC\Anaconda3\envs\PyPSA\lib\site-packages\ipykernel_launcher.py:21: RuntimeWarning:
>
> invalid value encountered in double_scalars
>
> C:\Users\PC\Anaconda3\envs\PyPSA\lib\site-packages\ipykernel_launcher.py:22: RuntimeWarning:
>
> invalid value encountered in double_scalars
>
> C:\Users\PC\Anaconda3\envs\PyPSA\lib\site-packages\ipykernel_launcher.py:23: RuntimeWarning:
>
> invalid value encountered in double_scalars
>
> ValueErrorTraceback (most recent call last)
> <ipython-input-75-8b60cdc20b06> in <module>()
> 22 network.generators_t.p[node+' solar'].sum()/gen[node],
> 23 network.generators_t.p[node+' hydro'].sum()/gen[node]],
> ---> 24size=2.5*gen[node]/overall_gen) 25
> 26 #plt.savefig('gen_distr.pdf')
>
> <ipython-input-74-896d2eb2da0a> in draw_pie(ax, pieces, X, Y, size, colors, alpha, zorder)
> 11
> 12 #http://matplotlib.org/examples/api/patch_collection.html
> ---> 13wedge = Wedge((X, Y), radius, 360*start, 360*(start+ratio), facecolor=colors[i],alpha=alpha,zorder=zorder)
> 14
> 15 ax.add_patch(wedge)
>
> C:\Users\PC\Anaconda3\envs\PyPSA\lib\site-packages\matplotlib\patches.pyc in __init__(self, center, r, theta1, theta2, width, **kwargs)
> 1031 self.theta1, self.theta2 = theta1, theta2
> 1032 self._patch_transform = transforms.IdentityTransform()
> -> 1033self._recompute_path()
> 1034
> 1035 def _recompute_path(self):
>
> C:\Users\PC\Anaconda3\envs\PyPSA\lib\site-packages\matplotlib\patches.pyc in _recompute_path(self)
> 1043
> 1044 # Form the outer ring
> -> 1045arc = Path.arc(theta1, theta2)
> 1046
> 1047 if self.width is not None:
>
> C:\Users\PC\Anaconda3\envs\PyPSA\lib\site-packages\matplotlib\path.pyc in arc(cls, theta1, theta2, n, is_wedge)
> 878 # number of curve segments to make
> 879 if n is None:
> --> 880n = int(2 ** np.ceil((eta2 - eta1) / halfpi))
> 881 if n < 1:
> 882 raise ValueError("n must be >= 1 or None")
>
> ValueError: cannot convert float NaN to integer
>
> --
> 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 post to this group, send email to py...@googlegroups.com
> <mailto:py...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/pypsa/f7289cdb-3280-4bec-bcd5-2f04ce7d13d8%40googlegroups.com
> <https://groups.google.com/d/msgid/pypsa/f7289cdb-3280-4bec-bcd5-2f04ce7d13d8%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


--
Tom Brown
Postdoctoral Researcher
Frankfurt Institute for Advanced Studies
https://fias.uni-frankfurt.de/physics/schramm/renewable-energy-system-and-network-analysis/
Personal site: https://www.nworbmot.org
Phone: +49 69 798 47693
Reply all
Reply to author
Forward
0 new messages