示例#1
0
def Carbonatites():
    '''
    Load Carbonatite data from Humphreys-Williams and Zahirovic (2021)
    '''
    fname = _retrieve(
        url="https://zenodo.org/record/5968095/files/1_CarbonatitesShapefile_WithAgeConstraints.zip?download=1",
        known_hash="md5:7f219044c7a1ea9d81fc3410b64b2876",  
        downloader=_HTTPDownloader(progressbar=True),
        path=_os_cache('gprm'),
        processor=_Unzip(extract_dir='Carbonatites')
    )

    gdf = _gpd.read_file('{:s}/Carbonatites/1_CarbonatitesShapefile_WithAgeConstraints/carbonatites_gplates.shp'.format(str(_os_cache('gprm'))))

    return gdf
示例#2
0
def Kimberlites():
    '''
    Load the Kimberlite compilation from Faure (2010)
    '''
    fname = _retrieve(
        url="https://consorem2.uqac.ca/production_scientifique/fiches_projets/world_kimberlites_and_lamproites_consorem_database_v2010.xls",
        known_hash="sha256:8d9d8d89afa9304b6494ad32b8f66f6838de5631287c94155d498b7f6d413ac4",  
        downloader=_HTTPDownloader(progressbar=True),
        path=_os_cache('gprm'),
    )

    df = _pd.read_excel(fname, skiprows=1)
    gdf = _gpd.GeoDataFrame(df, geometry=_gpd.points_from_xy(df.Longitude, df.Latitude), crs=4326)

    return gdf
示例#3
0
def Metamorphism():
    '''
    Load the Metamorphims compilation from Brown and Johnson, as reported in the SM of Liu et al (2022)
    '''
    fname = _retrieve(
        url="https://gsapubs.figshare.com/ndownloader/files/33947312",
        known_hash="fa815bc1f07c347834dc4e9724285bfff12176bd42d5330cbc0cabeab1757fc4",  
        downloader=_HTTPDownloader(progressbar=True),
        path=_os_cache('gprm'),
    )

    df = _pd.read_excel(fname, skiprows=1)
    df = df.rename(columns={'LONGITUDE (˚E)':'Longitude', 'LATITUDE (˚N)':'Latitude'})
    df['Age'] = df['AGE(Ga)']*1000.
    gdf = _gpd.GeoDataFrame(df, geometry=_gpd.points_from_xy(df.Longitude, df.Latitude), crs=4326)

    return gdf
def PacificSeamountAges(load=True):
    '''
    Pacific Seamount Age compilation from GMT website

    '''
    fname = _retrieve(
        url="https://www.earthbyte.org/webdav/gmt_mirror/gmt/data/cache/Pacific_Ages.txt",
        known_hash="sha256:8c5e57b478c2c2f5581527c7aea5ef282e976c36c5e00452210885a92e635021",  
        downloader=_HTTPDownloader(progressbar=True),
        path=_os_cache('gprm'),
    )
    
    if load:
        df = _pd.read_csv(fname, comment='#', delim_whitespace=True,
                          names=['Long', 'Lat', 'Average_Age_Ma', 'Average_Age_Error_Ma', 'Tag', 'SeamountName', 'SeamountChain'])
        return _gpd.GeoDataFrame(df, geometry=_gpd.points_from_xy(df.Long, df.Lat))
    else:
        return fname
def MagneticPicks(load=True):
    '''
    Magnetic Picks from the 'Global Seafloor Fabric (and) Magnetic Linations' 
    database, returned as a geopandas dataframe
    Alternatively, select 'load=False' to return filname of '.gmt' file in 
    cache folder

    '''
    fname = _retrieve(
        url="http://www.soest.hawaii.edu/PT/GSFML/ML/DATA/GSFML.global.picks.gmt",
        known_hash="sha256:0895b76597f600a6c6184a7bec0edc0df5ca9234255f3f7bac0fe944317caf65",  
        downloader=_HTTPDownloader(progressbar=True),
        path=_os_cache('gprm'),
    )
    
    if load:
        return _gpd.read_file(fname)
    else:
        return fname
def load_Hf():

    fname = _retrieve(
        url=
        "https://ars.els-cdn.com/content/image/1-s2.0-S0012825221002464-mmc5.xlsx",
        known_hash=
        "sha256:7402470ca7e7319899d949207da3eae8c0ba20bdf21050a85ca70ff6c9be9b8c",
        downloader=_HTTPDownloader(progressbar=True),
        path=_os_cache('gprm'),
    )

    xls = _pd.ExcelFile(fname)
    df = _pd.read_excel(xls, sheet_name='Hf_Data')

    gdf = _gpd.GeoDataFrame(df,
                            geometry=_gpd.points_from_xy(
                                df.Longitude, df.Latitude),
                            crs=4326)

    return gdf
def pbdb(path_to_pbdb_data=None):
    """
    Load data from pbdb downloaded file (not retrieved by pooch)

    The function assumes that a file has already been downloaded using 
    the pbdb navigator interface to the pbdb web service (version 1.2)
    """

    if not path_to_pbdb_data:
        path_to_pbdb_data = '{:s}/pbdb/pbdb_data.csv'.format(
            str(_os_cache('gprm')))

    df = _pd.read_csv(path_to_pbdb_data, delimiter=',', skiprows=14)

    df.rename(columns={'lng': 'Longitude', 'lat': 'Latitude'}, inplace=True)

    gdf = _gpd.GeoDataFrame(df,
                            geometry=_gpd.points_from_xy(
                                df.Longitude, df.Latitude),
                            crs=4326)

    return gdf
示例#8
0
def MarsTopo2600(lmax=2600):
    '''
    MarsTopo2600 is a 2600 degree and order spherical harmonic model of the
    shape of the planet Mars. The coefficients are in units of meters.

    Parameters
    ----------
    lmax : int, optional
        The maximum spherical harmonic degree to return.

    Reference
    ---------
    Wieczorek, M.A. (2015). Gravity and Topography of the Terrestrial Planets,
        Treatise on Geophysics, 2nd edition, Oxford, 153-193,
        doi:10.1016/B978-0-444-53802-4.00169-X.
    '''
    fname = _retrieve(
        url="https://zenodo.org/record/3870922/files/MarsTopo2600.shape.gz",
        known_hash="sha256:8882a9ee7ee405d971b752028409f69bd934ba5411f1c64eaacd149e3b8642af",  # noqa: E501
        downloader=_HTTPDownloader(progressbar=True),
        path=_os_cache('pyshtools'),
    )
    return _SHCoeffs.from_file(fname, lmax=lmax, units='m')
示例#9
0
def Geochem(usecols=None, return_column_names=False, remove_invalid_coordinates=True):
    '''
    Load the geochemistry database of Gard et al (2019)
    doi: https://doi.org/10.5194/essd-11-1553-2019

    Options:
    usecols: optionally define a list of columns to load (rather than the full table) [default=None]
    remove_invalid_coordinates: specify whether to remove rows from the table for which the latitude
                                and/or longitide are invalid [default=True] 
    return_column_names: instead of loading table into memory, return a list of column names

    '''
    fname = _retrieve(
        url="https://zenodo.org/record/3359791/files/complete.zip",
        known_hash="md5:9b97b54887ee7184c6650c845b4e92d4",  
        downloader=_HTTPDownloader(progressbar=True),
        path=_os_cache('gprm'),
        processor=_Unzip(extract_dir='GeochemDB'),
    )[0]
    
    if usecols:
        # TODO if 'Long and Lat fields are not included, the attempt to create a gdf will throw an error - fix this
        usecols = ['longitude' if x=='Longitude' else x for x in usecols]
        usecols = ['latitude' if x=='Latitude' else x for x in usecols]

    # TODO include some shorthands for the usecols, e.g. 'Major', 'REE', etc

    if return_column_names:
        return _pd.read_csv(fname, index_col=0, nrows=0, engine='python').columns.tolist()

    else:
        df = _pd.read_csv(fname, usecols=usecols, engine='python', encoding="ISO-8859-1")
        if remove_invalid_coordinates:
            df = df.dropna(subset=['longitude','latitude'])
            df.reset_index(inplace=True)
        df.rename(columns={'longitude':'Longitude', 'latitude':'Latitude'}, inplace=True)
        return _gpd.GeoDataFrame(df, geometry=_gpd.points_from_xy(df.Longitude, df.Latitude), crs=4326)
示例#10
0
文件: Moon.py 项目: spacefan/SHTOOLS
def GRGM1200B_RM1_1E0(lmax=1200):
    '''
    GRGM1200B_RM1_1E0 is a GSFC 1200 degree and order spherical harmonic model
    of the gravitational potential of the Moon. This model uses a rank-minus-1
    constraint based on gravity from surface topography for degrees greater
    than 600 with a value of lambda equal to 1.

    Parameters
    ----------
    lmax : int, optional
        The maximum spherical harmonic degree to return.

    Reference
    ---------
    Goossens, S., Sabaka, T.J., Wieczorek, M.A., Neumann, G.A., Mazarico, E.,
        Lemoine, F.G., Nicholas, J.B., Smith. D.E., Zuber M.T. (2020).
        High-resolution gravity field models from GRAIL data and implications
        for models of the density structure of the Moon's crust. Journal of
        Geophysical Research Planets, 125, e2019JE006086,
        doi:10.1029/2019JE006086.
    '''
    fname = _retrieve(
        url=
        "https://core2.gsfc.nasa.gov/PGDA/data/MoonRM1/sha.grgm1200b_rm1_1e0_sigma",  # noqa: E501
        known_hash=
        "sha256:d42536cc716f5da8e067aa79a253c310e9d53d1d3b3ae7b43fa4517654d20d35",  # noqa: E501
        downloader=_HTTPDownloader(progressbar=True),
        path=_os_cache('pyshtools'),
    )
    return _SHGravCoeffs.from_file(fname,
                                   lmax=lmax,
                                   header_units='m',
                                   r0_index=1,
                                   gm_index=0,
                                   errors=True,
                                   omega=_omega.value,
                                   name='GRGM1200B_RM1_1E0')
示例#11
0
def VenusTopo719(lmax=719):
    '''
    VenusTopo719 is a 719 degree and order spherical harmonic model of the
    shape of the planet Venus. The coefficients are in units of meters.

    Parameters
    ----------
    lmax : int, optional
        The maximum spherical harmonic degree to return.

    Reference
    ---------
    Wieczorek, M.A. (2015). Gravity and Topography of the Terrestrial Planets,
        Treatise on Geophysics, 2nd edition, Oxford, 153-193,
        doi:10.1016/B978-0-444-53802-4.00169-X.
    '''
    fname = _retrieve(
        url="https://zenodo.org/record/3870926/files/VenusTopo719.shape.gz",
        known_hash=
        "sha256:9fcb04fb21eb7090df68e42458f6d7495a27ff62687b46534057ed608786cf3b",  # noqa: E501
        downloader=_HTTPDownloader(progressbar=True),
        path=_os_cache('pyshtools'),
    )
    return _SHCoeffs.from_file(fname, lmax=lmax, units='m')
示例#12
0
文件: Moon.py 项目: spacefan/SHTOOLS
def T2015_449(lmax=449):
    '''
    T2015_449 is a 449 degree and order spherical harmonic model of the
    magnetic potential of the Moon. This model was used in Wieczorek (2018) and
    is a spherical harmonic expansion of the global magnetic field model of
    Tsunakawa et al. (2015). The coefficients are output in units of nT.

    Parameters
    ----------
    lmax : int, optional
        The maximum spherical harmonic degree to return.

    References
    ----------
    Tsunakawa, H., Takahashi, F., Shimizu, H., Shibuya, H., Matsushima, M.
        (2015). Surface vector mapping of magnetic anomalies over the Moon
        using Kaguya and Lunar Prospector observations, Journal of Geophysical
        Research Planets, 120, 1160-1185, doi:10.1002/2014JE004785.
    Wieczorek, M.A. (2018). Strength, depth, and geometry of magnetic sources
        in the crust of the Moon from localized power spectrum analysis,
        Journal of Geophysical Research Planets, 123, 291-316,
        doi:10.1002/2017JE005418.
    '''
    fname = _retrieve(
        url="https://zenodo.org/record/3873648/files/T2015_449.sh.gz",
        known_hash=
        "sha256:4db0b77b3863f38d6fb6e62c5c1116bf7123b77c5aad65df7dae598714edd655",  # noqa: E501
        downloader=_HTTPDownloader(progressbar=True),
        path=_os_cache('pyshtools'),
    )
    return _SHMagCoeffs.from_file(fname,
                                  lmax=lmax,
                                  header=True,
                                  file_units='T',
                                  name='T2015_449',
                                  units='nT')
示例#13
0
文件: Moon.py 项目: spacefan/SHTOOLS
def GRGM1200B(lmax=1200):
    '''
    GRGM1200B is a GSFC 1200 degree and order spherical harmonic model of the
    gravitational potential of the Moon. This model applies a Kaula constraint
    for degrees greater than 600.

    Parameters
    ----------
    lmax : int, optional
        The maximum spherical harmonic degree to return.

    Reference
    ---------
    Goossens, S., Sabaka, T.J., Wieczorek, M.A., Neumann, G.A., Mazarico, E.,
        Lemoine, F.G., Nicholas, J.B., Smith. D.E., Zuber M.T. (2020).
        High-resolution gravity field models from GRAIL data and implications
        for models of the density structure of the Moon's crust. Journal of
        Geophysical Research Planets, 125, e2019JE006086,
        doi:10.1029/2019JE006086.
    '''
    fname = _retrieve(
        url=
        "https://core2.gsfc.nasa.gov/PGDA/data/MoonRM1/sha.grgm1200b_sigma",  # noqa: E501
        known_hash=
        "sha256:f08a988b43f3eaa5a2089045a9b7e41e02f16542c7912b87ea34366fafa39bc5",  # noqa: E501
        downloader=_HTTPDownloader(progressbar=True),
        path=_os_cache('pyshtools'),
    )
    return _SHGravCoeffs.from_file(fname,
                                   lmax=lmax,
                                   header_units='m',
                                   r0_index=1,
                                   gm_index=0,
                                   errors=True,
                                   omega=_omega.value,
                                   name='GRGM1200B')
def loadDB(version=2021):
    '''
    Load the Puetz (2018) database, returning two dataframes:
     - the Sample Details
     - the Data table
    '''

    if version == 2018:
        fname = _retrieve(
            url=
            "https://ars.els-cdn.com/content/image/1-s2.0-S1674987117302141-mmc1.xlsx",
            known_hash=
            "sha256:8ea19b08d5c8d3c6e7f3239471d27b6da440fcfa40994e712ac9ae95642fe3d9",
            downloader=_HTTPDownloader(progressbar=True),
            path=_os_cache('gprm'),
        )

        # load the whole xls file once to avoid duplication
        xls = _pd.ExcelFile(fname)

        # Get dataframes for the sheets with information per site and per sample
        df_Data = _pd.read_excel(xls, sheet_name='Data')
        df_SampleDetails = _pd.read_excel(xls, sheet_name='Sample_Details')

        # rename some fields for neatness
        df_Data.rename(columns={
            u'206Pb /\n238U\nAge\n(Ma)': '206Pb_238U_Age_Ma',
            u'206Pb /\n238U\n2σ\nPrecis': '206Pb_238U_Precis',
            u'207Pb /\n235U\nAge\n(Ma)': '207Pb_235U_Age_Ma',
            u'207Pb /\n235U\n2σ\nPrecis': '207Pb_235U_Precis',
            u'207Pb /\n206Pb\nAge\n(Ma)': '207Pb_206Pb_Age_Ma',
            u'207Pb /\n206Pb\n2σ\nPrecis': '207Pb_206Pb_Precis'
        },
                       inplace=True)

        df_SampleDetails.rename(
            columns={'Est. Depos. Age (Ma)': 'Est_Depos_Age_Ma'}, inplace=True)
        df_SampleDetails = df_SampleDetails.dropna(subset=['Sample Key'])

        return df_SampleDetails, df_Data

    elif version == 2021:

        fname = _retrieve(
            url=
            "https://ars.els-cdn.com/content/image/1-s2.0-S0012825221002464-mmc4.xlsx",
            known_hash=
            "sha256:afdcaa26698ba06f113f29fab311af0ec37f290db117fc85847966c28b78ff09",
            downloader=_HTTPDownloader(progressbar=True),
            path=_os_cache('gprm'),
        )

        xls = _pd.ExcelFile(fname)
        df = _pd.read_excel(xls, sheet_name='UPb_Data')

        gdf = _gpd.GeoDataFrame(df,
                                geometry=_gpd.points_from_xy(
                                    df.Longitude, df.Latitude),
                                crs=4326)

        return gdf
def fetch_Paleomap(resolution='01d'):
    """
    PaleoDEM rasters from Scotese and Wright (2018)
    
    resolution can be '01d' (default) or '06m'
    """

    if resolution == '01d':
        fnames = _retrieve(
            url=
            "https://zenodo.org/record/5460860/files/Scotese_Wright_2018_Maps_1-88_1degX1deg_PaleoDEMS_nc.zip?download=1",
            known_hash="md5:77147998623ab039d86ff3e0b5e40344",
            downloader=_HTTPDownloader(progressbar=True),
            path=_os_cache('gprm'),
            processor=_Unzip(extract_dir='Paleomap_01d'),
        )

        dirname = '{:s}/Paleomap_01d/Scotese_Wright_2018_Maps_1-88_1degX1deg_PaleoDEMS_nc_v2'.format(
            fnames[0].split('Paleomap_01d')[0])
        #dirname = '{:s}/Scotese_Wright_2018_Maps_1-88_1degX1deg_PaleoDEMS_nc_v2'.format(_os.path.split(fnames[0])[0])

        # if downloading for first time, remove the unwanted cache files
        for file in _os.listdir(dirname):
            if file.endswith(".cache"):
                _os.remove('{:s}/{:s}'.format(dirname, file))

        raster_dict = {}
        for file in _os.listdir(dirname):
            if file.endswith(".nc"):
                # Replace whitespace with underscore to help pygmt plotting
                if ' ' in file:
                    _os.rename(
                        '{:s}/{:s}'.format(dirname, file),
                        '{:s}/{:s}'.format(dirname, file.replace(' ', '_')))
                raster_dict[float(
                    file.split('_')[-1][:-5])] = '{:s}/{:s}'.format(
                        dirname, file.replace(' ', '_'))

        ordered_raster_dict = collections.OrderedDict(
            sorted(raster_dict.items()))

        return ordered_raster_dict

    elif resolution == '06m':
        fnames = _retrieve(
            url=
            "https://zenodo.org/record/5460860/files/Scotese_Wright_2018_Maps_1-88_6minX6min_PaleoDEMS_nc.zip?download=1",
            known_hash="md5:89eb50d8645707ab221b023078535bda",
            downloader=_HTTPDownloader(progressbar=True),
            path=_os_cache('gprm'),
            processor=_Unzip(extract_dir='Paleomap_06m'),
        )

        dirname = '{:s}/Paleomap_06m/Scotese_Wright_2018_Maps_1-88_6minX6min_PaleoDEMS_nc'.format(
            fnames[0].split('Paleomap_06m')[0])
        #dirname = '{:s}/Scotese_Wright_2018_Maps_1-88_6minX6min_PaleoDEMS_nc'.format(_os.path.split(fnames[0])[0])

        raster_dict = {}
        for file in _os.listdir(dirname):
            if file.endswith(".nc"):
                # Replace whitespace with underscore to help pygmt plotting
                if ' ' in file:
                    _os.rename(
                        '{:s}/{:s}'.format(dirname, file),
                        '{:s}/{:s}'.format(dirname, file.replace(' ', '_')))
                raster_dict[float(
                    file.split('_')[-1][:-5])] = '{:s}/{:s}'.format(
                        dirname, file.replace(' ', '_'))

        ordered_raster_dict = collections.OrderedDict(
            sorted(raster_dict.items()))

        return ordered_raster_dict

    else:
        ValueError(
            'Spacing for source grids must be either 01d (for 1 degree version) or 06m (for 6 minute version)'
        )