示例#1
0
def load_data():
    """ load data """

    ifile = r'C:\Work\Programming\pygmi\data\anaglyph\Subset_Thelon_River_TMI.ers'

    idat = io.get_raster(ifile)
    idat = idat[0]

    z = idat.data
    dxy = idat.xdim

    #    pdb.set_trace()
    #
    #
    #    z = np.loadtxt(r'c:\work\programming\pygmi\data\test\mag.asc', skiprows=6)
    z = np.ma.masked_equal(z, 1e+20)

    y, x = np.indices(z.shape)

    #    dxy = 125
    #    dxy = 125

    x *= int(dxy)
    y *= int(dxy)

    #    x = x[20:100, 25:150]
    #    y = y[20:100, 25:150]
    #    z = z[20:100, 25:150]

    #    z.set_fill_value(np.nan)
    #    z = z.filled()
    #    z = np.ma.masked_invalid(z)

    return x, y, z
示例#2
0
文件: tests.py 项目: wqqpp007/pygmi
def tests_rtp():
    """ Tests to debug RTP """
    import matplotlib.pyplot as plt

    datrtp = get_raster(r'C:\Work\Programming\pygmi\data\RTP\South_Africa_EMAG2_diffRTP_surfer.grd')
    dat = get_raster(r'C:\Work\Programming\pygmi\data\RTP\South_Africa_EMAG2_TMI_surfer.grd')
    dat = dat[0]
    datrtp = datrtp[0]
    incl = -65.
    decl = -22.

    dat2 = dp.rtp(dat, incl, decl)

    plt.subplot(2, 1, 1)
    plt.imshow(dat.data, vmin=-1200, vmax=1200)
    plt.colorbar()
    plt.subplot(2, 1, 2)
    plt.imshow(dat2.data, vmin=-1200, vmax=1200)
    plt.colorbar()
    plt.show()
示例#3
0
def test():
    """Test."""
    sys.path.append(
        os.path.abspath(os.path.join(os.path.dirname(__file__), '..//..')))
    from pygmi.raster import iodefs
    app = QtWidgets.QApplication(sys.argv)

    data = iodefs.get_raster(r'C:\WorkData\Change\cutdata.tif')

    tmp = SuperClass(None)
    tmp.indata['Raster'] = data
    tmp.settings()
示例#4
0
def test_io_xyz(smalldata):
    """Tests IO for xyz files."""
    ofile = tempfile.gettempdir() + '\\iotest.xyz'

    tmp = iodefs.ExportData(None)
    tmp.ifile = ofile
    tmp.export_ascii_xyz([smalldata])

    dat2 = iodefs.get_raster(ofile)

    # Cleanup files
    for i in glob.glob(tempfile.gettempdir() + '\\iotest*'):
        os.unlink(i)

    np.testing.assert_array_equal(smalldata.data, dat2[0].data)
示例#5
0
def test_io_gdal(smalldata, ext, drv):
    """Tests IO for gdal files."""
    ofile = tempfile.gettempdir() + '\\iotest' + ext

    tmp = iodefs.ExportData(None)
    tmp.ifile = ofile
    tmp.export_gdal([smalldata], drv)

    dat2 = iodefs.get_raster(ofile)

    # Cleanup files
    for i in glob.glob(tempfile.gettempdir() + '\\iotest*'):
        os.unlink(i)

    np.testing.assert_array_equal(smalldata.data, dat2[0].data)
示例#6
0
def load_data():
    """ load data """

    ifile = r'C:\Work\Programming\pygmi\data\anaglyph\Subset_Thelon_River_TMI.ers'
    ifile = r'C:\Work\Programming\pygmi\data\testdata.hdr'
    #    ifile = r'C:\Work\Programming\pygmi\data\anaglyph\seqld2_vrtp.ers'

    idat = io.get_raster(ifile)
    idat = idat[1]

    z = idat.data
    dxy = idat.xdim

    plt.imshow(z)
    plt.show()

    z = np.ma.masked_equal(z, 1e+20)

    y, x = np.indices(z.shape)

    x *= int(dxy)
    y *= int(dxy)

    return x, y, z