Skip to content

Instantly share code, notes, and snippets.

@nipunbatra
Created January 21, 2016 13:39
Show Gist options
  • Save nipunbatra/25aa107c9fab44dbbe1f to your computer and use it in GitHub Desktop.
Save nipunbatra/25aa107c9fab44dbbe1f to your computer and use it in GitHub Desktop.
import json
f = open("/Users/nipunbatra/Downloads/testHP.drw",'r')
stream = f.read()
stream = stream.replace("\n",'')
stream = stream.replace("\xef\xbb\xbf","")
stream = stream.replace("HP := ","")
stream = stream.replace(":","")
three_d_array = json.loads(stream)
#shape
shape = len(three_d_array), len(three_d_array[0]), len(three_d_array[0][0])
import numpy as np
numpy_3d = np.array(three_d_array)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment