Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.

Ploting an array[][] on Jyhton

Hello everybody:

I'm having some problems on plotting a 512*512 array of float. I get the
message:

TypeError:field(): 1st arg can't be coercd to float[] or
float[][]

But on the Jyhton tutorial there is an exemple doing the same thing with
no problem.

Here is my code:

--------------------------------------------------
import struct
import math
from struct import *
from visad.python.JPythonMethods import *

matriz = []
file=open("radar200108291645Z.dat",'rb')
for i in range(512):
        linha = []
        g=file.read(2048)
        linha.append(struct.unpack('512f',g)) 
        matriz.append(linha)
f=field(matriz)
plot(f)

-------------------------------------------
And the code in the tutorial

-------------------------------------------
from visad.python.JPythonMethods import *
import math

z = []
for i in range(0,32):
  a = []
  for j in range(0,32):
    a.append( math.sin(i*j*.0174533))
  z.append(a)

f = field(z)
plot(f)

Thaks 

CICERO
cicero@xxxxxxxxxx


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: