def test_random_extents(self): nblocks = 100 blocksize = 2000 random_file = RandomWalkGenerator( 'noName', nblocks=nblocks, blocksize=blocksize, ) extents = random_file.get_surface_extents() ans = DT.extents(ndims=2, prec=DT.PRECISION, ll_default=(0, 0), ur_default=(1, 1)) assert_array_equal(ans['ll'], extents['ll']) assert_array_equal(ans['ur'], extents['ur']) extents = random_file.get_subsurface_extents() ans = DT.extents(ndims=2, prec=DT.PRECISION, ll_default=(0, 0, 0), ur_default=(1, 1, 1)) assert_array_equal(ans['ll'], extents['ll']) assert_array_equal(ans['ur'], extents['ur'])
def get_extents(self, ndims, spillets=None): if ndims == 2: return DT.extents(ndims=2, prec=DT.PRECISION, ur_default=(1, 1), ll_default=(0, 0)) elif ndims == 3: return DT.extents(ndims=3, prec=DT.PRECISION, ur_default=(1, 1, 1), ll_default=(0, 0, 0)) else: raise PyStochIOError('Invalid number of dimensions selected.')
def get_extents(self, ndims, spillets=None): result = DT.extents(ndims=ndims, prec=DT.SPRECISION) pmin = result['ll'][0] pmax = result['ur'][0] pmax[0] = numpy.max(self._record_data["UR Bound"]["Lon"], axis=0) pmax[1] = numpy.max(self._record_data["UR Bound"]["Lat"], axis=0) pmin[0] = numpy.min(self._record_data["LL Bound"]["Lon"], axis=0) pmin[1] = numpy.min(self._record_data["LL Bound"]["Lat"], axis=0) # Add a little margin to the actual value... result['ll'][0] = pmin - 0.001 * abs(pmin) result['ur'][0] = pmax + 0.001 * abs(pmax) return result