Related data repo.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
655B

  1. import numpy as np
  2. import csv
  3. import pdb
  4. wFile = open("output.dat",'r')
  5. gridNN = 0
  6. line = wFile.readline()
  7. while line != "\n" :
  8. if line.lstrip()[0] != "#" :
  9. lineData = line.split()
  10. varNN = len(lineData)
  11. gridNN += 1
  12. line = wFile.readline()
  13. wFile.seek(0,0)
  14. data = []
  15. tmp = np.zeros([gridNN,varNN])
  16. gridII = 0
  17. for line in wFile :
  18. if (line == "\n") and (gridII != 0) :
  19. data.append(tmp)
  20. tmp = np.zeros([gridNN,varNN])
  21. gridII = 0
  22. elif (line != "\n") and (line.lstrip()[0] != "#") :
  23. tmp[gridII,:] = np.array(line.split(),dtype=float)
  24. gridII += 1
  25. np.save("output.npy",data)