Jump to content
Fórum Script Brasil
  • 0

Problemas com zero-size array



Fala galera, tudo bom? Tou tentando plotar um diagrama T-S aqui porém, ocorre um erro: ValueError: zero-size array to reduction operation minimum which has no identity. Alguém sabe como proceder? Valeu.



import numpy as np
import matplotlib.pyplot as plt
import seawater as gsw

y, x = np.loadtxt(r'.txt',dtype='float',delimiter=None, unpack=True)
y1, x1 = np.loadtxt(r'.txt',dtype='float',delimiter=None, unpack=True)

sal = x
temp = x1
y = y1

smin = sal.min() - (0.01 * sal.min())
smax = sal.max() + (0.01 * sal.max())
tmin = temp.min() - (0.1 * temp.max())
tmax = temp.max() + (0.1 * temp.max())

xdim = round((smax-smin)/0.1+1,0)
ydim = round((tmax-tmin)+1,0)

dens = np.zeros((ydim,xdim))

ti = np.linspace(1,ydim-1,ydim)+tmin
si = np.linspace(1,xdim-1,xdim)*0.1+smin

fig1 = plt.figure()
ax1 = fig1.add_subplot(111)
CS = plt.contour(si, ti, dens, linestyles='dashed', colors='k')
plt.clabel(CS, fontsize=12, inline=1, fmt='%1.0f') # Label every second level
ax1.set_ylabel('Temperature (C)')




Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...