示例#1
0
 def setUp(self):
     self.test_dir = tempfile.mkdtemp()
     # structured field with a size 100x100x100 and a grid-size of 1x1x1
     x = y = z = range(100)
     model = Gaussian(dim=3, var=0.6, len_scale=20)
     self.srf_structured = SRF(model)
     self.srf_structured((x, y, z), mesh_type="structured")
     # unstrucutred field
     seed = MasterRNG(19970221)
     rng = np.random.RandomState(seed())
     x = rng.randint(0, 100, size=10000)
     y = rng.randint(0, 100, size=10000)
     model = Exponential(
         dim=2, var=1, len_scale=[12.0, 3.0], angles=np.pi / 8.0
     )
     self.srf_unstructured = SRF(model, seed=20170519)
     self.srf_unstructured([x, y])
示例#2
0
import numpy as np
import matplotlib.pyplot as pt
from gstools import SRF, Gaussian
from gstools.random import MasterRNG

x = y = np.arange(100)

model = Gaussian(dim=2, var=1, len_scale=10)
srf = SRF(model)

ens_no = 4
field = []
seed = MasterRNG(20170519)
for i in range(ens_no):
    field.append(srf((x, y), seed=seed(), mesh_type="structured"))

fig, ax = pt.subplots(2, 2, sharex=True, sharey=True)
ax = ax.flatten()
for i in range(ens_no):
    ax[i].imshow(field[i].T, origin="lower")

pt.show()
示例#3
0
import numpy as np
import matplotlib.pyplot as pt
from gstools import SRF, Exponential
from gstools.random import MasterRNG

# creating our own unstructured grid
seed = MasterRNG(19970221)
rng = np.random.RandomState(seed())
x = rng.randint(0, 100, size=10000)
y = rng.randint(0, 100, size=10000)

model = Exponential(dim=2, var=1, len_scale=[12.0, 3.0], angles=np.pi / 8.0)

srf = SRF(model, seed=20170519)

field = srf((x, y))
srf.vtk_export("field")

pt.tricontourf(x, y, field.T)
pt.axes().set_aspect("equal")
pt.show()
示例#4
0
import numpy as np
import matplotlib.pyplot as pt
from gstools import SRF, Exponential
from gstools.random import MasterRNG

# creating our own unstructured grid
seed = MasterRNG(19970221)
rng = np.random.RandomState(seed())
x = rng.randint(0, 100, size=10000)
y = rng.randint(0, 100, size=10000)

model = Exponential(dim=2, var=1, len_scale=[12., 3.], angles=np.pi / 8.)

srf = SRF(model, seed=20170519)

field = srf((x, y))

# new grid
seed = MasterRNG(20011012)
rng = np.random.RandomState(seed())
x2 = rng.randint(99, 150, size=10000)
y2 = rng.randint(20, 80, size=10000)

field2 = srf((x2, y2))

pt.tricontourf(x, y, field.T)
pt.tricontourf(x2, y2, field2.T)
pt.axes().set_aspect('equal')
pt.show()