Skip to content

Commit

Permalink
fix: remove support for fetch ROSETTA grav and mag to align with goal…
Browse files Browse the repository at this point in the history
… of only providing common and widespread datasets
  • Loading branch information
mdtanker committed Jun 5, 2024
1 parent 69450ac commit 4dadc7c
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 734 deletions.
2 changes: 0 additions & 2 deletions docs/datasets/antarctica/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ modis_moa
---
gravity
magnetics
rosetta_gravity
rosetta_magnetics
```

## Geophysically-derived data
Expand Down
225 changes: 0 additions & 225 deletions docs/datasets/antarctica/rosetta_gravity.ipynb

This file was deleted.

230 changes: 0 additions & 230 deletions docs/datasets/antarctica/rosetta_magnetics.ipynb

This file was deleted.

2 changes: 0 additions & 2 deletions docs/datasets/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ antarctica/mass_change
antarctica/basal_melt
antarctica/groundingline
antarctica/ice_boundaries
antarctica/rosetta_gravity
antarctica/rosetta_magnetics
antarctica/geology
greenland/modis_mog
greenland/groundingline
Expand Down
2 changes: 0 additions & 2 deletions docs/tutorial/fetch_walkthrough.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@
"modis_mog\n",
"moho\n",
"rema\n",
"rosetta_gravity\n",
"rosetta_magnetics\n",
"sediment_thickness\n"
]
}
Expand Down
211 changes: 0 additions & 211 deletions src/polartoolkit/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2859,217 +2859,6 @@ def preprocessing(fname: str, action: str, _pooch2: typing.Any) -> str:
return typing.cast(xr.DataArray, resampled)


def rosetta_gravity(version: str = "gravity") -> pd.DataFrame:
"""
Load either a shapefile of ROSETTA-ice flightlines, a dataframe of ROSETTA-Ice
airborne gravity data over the Ross Ice Shelf, or a dataframe of ROSETTA-Ice density
values from the density inversion.
from :footcite:t:`tintoross2019`.
Accessed from https://www.usap-dc.org/view/project/p0010035
This is only data from the first 2 of the 3 field seasons.
Columns:
Line Number: The ROSETTA-Ice survey line number, >1000 are tie lines
Latitude (degrees): Latitude decimal degrees WGS84
Longitude (degrees): Longitude decimal degrees WGS84
unixtime (seconds): The number of seconds that have elapsed since midnight
(00:00:00 UTC) on January 1st, 1970
Height (meters): Height above WGS84 ellipsoid
x (meters): Polar stereographic projected coordinates true to scale at 71° S
y (meters): Polar stereographic projected coordinates true to scale at 71° S
FAG_levelled (mGal): Levelled free air gravity
Parameters
----------
version : str, optional
Returns
-------
pd.DataFrame
Returns a dataframe containing the gravity, density, or flightline data
References
----------
.. footbibliography::
"""

if version == "shapefile":
path = pooch.retrieve(
url="http://wonder.ldeo.columbia.edu/data/ROSETTA-Ice/GridInformation/Shapefile/ROSETTA-Ice_Grid_Flown_Shapefile.zip",
fname="ROSETTA-Ice_Grid_Flown_Shapefile.zip",
path=f"{pooch.os_cache('pooch')}/polartoolkit/gravity",
known_hash="17e0026fe386503d74c679a6091235e2394fb269030f5555372e55bdf61f6946",
progressbar=True,
processor=pooch.Unzip(),
)
# path to shapefile
fname = next(p for p in path if p.endswith(".shp"))

# read the file into a geodataframe
df = pyogrio.read_dataframe(fname)
elif version == "gravity":
path = pooch.retrieve(
url="http://wonder.ldeo.columbia.edu/data/ROSETTA-Ice/Gravity/rs_2019_grav.csv",
fname="ROSETTA_2019_grav.csv",
path=f"{pooch.os_cache('pooch')}/polartoolkit/gravity",
known_hash="d4fdfcc293ac13e6222938bfa9e1e9ccc781ea7556a13d356e9f1b4aba809928",
progressbar=True,
)

df = pd.read_csv(path)

# convert line numbers into float format (L200 -> 200)
df.Line = df.Line.str[1:]
df["Line"] = pd.to_numeric(df["Line"])

elif version == "density":
path = pooch.retrieve(
url="http://wonder.ldeo.columbia.edu/data/ROSETTA-Ice/DerivedProducts/Density/rs_2019_density.csv",
fname="rs_2019_density.csv",
path=f"{pooch.os_cache('pooch')}/polartoolkit/gravity",
known_hash="8c3d6f69087095ab1a184d0517a136ebd59e4761110601b30da1ef3685883617",
progressbar=True,
)

df = pd.read_csv(path)

# convert line numbers into float format (L200 -> 200)
df.Line = df.Line.str[1:]
df["Line"] = pd.to_numeric(df["Line"])

return df


def rosetta_magnetics() -> pd.DataFrame:
"""
Load a dataframe of ROSETTA-Ice airborne magnetics data over the Ross Ice Shelf
from :footcite:t:`tintoross2019`.
Accessed from https://www.usap-dc.org/view/project/p0010035
Columns:
Line Number: The ROSETTA-Ice survey line number, >1000 are tie lines
Latitude (degrees): Latitude decimal degrees WGS84
Longitude (degrees): Longitude decimal degrees WGS84
unixtime (seconds): The number of seconds that have elapsed since midnight
(00:00:00 UTC) on January 1st, 1970
H_Ell (meters): Height above WGS84 ellipsoid
x (meters): Polar stereographic projected coordinates true to scale at 71° S
y (meters): Polar stereographic projected coordinates true to scale at 71° S
Mag_anomaly (nT): magnetic anomaly
Returns
-------
pd.DataFrame
Returns a dataframe containing the data
References
----------
.. footbibliography::
"""
url = "http://wonder.ldeo.columbia.edu/data/ROSETTA-Ice/Magnetics/rs_2019_mag.csv"
fname = "rs_2019_mag.csv"

path = pooch.retrieve(
url=url,
fname=fname,
path=f"{pooch.os_cache('pooch')}/polartoolkit/magnetics",
known_hash="6a87e59b86888a2cd669012c6ad49ea5e563d1a9759da574d5a9f9b5aa978b70",
progressbar=True,
)

df = pd.read_csv(path)

# convert line numbers into float format (L200 -> 200)
df.Line = df.Line.str[1:]
df["Line"] = pd.to_numeric(df["Line"])

# drop rows with height or mag data
return df.dropna(subset=["H_Ell", "Mag_anomaly"])


# def rosetta_radar_data(version: str="basal_melt") -> pd.DataFrame:
# """
# Load ice thickness, basal melt rate, and basal melt rate errors from the
# ROSETTA-Ice radar data.

# from Das et al. (2020). Multi-decadal basal melt rates and structure of the Ross
# Ice Shelf, Antarctica using airborne ice penetrating radar. Journal of Geophysical
# Research: Earth Surface, 125 (doi:10.1029/2019JF005241)

# Accessed from https://www.usap-dc.org/view/dataset/601242

# or from http://wonder.ldeo.columbia.edu/data/ROSETTA-Ice/DerivedProducts/

# CURRENTLY NOT WORKING DUE TO RECAPTCHA ON USAP-DC WEBSITE

# Parameters
# ----------
# version : str, optional

# Returns
# -------
# pd.DataFrame
# Returns a dataframe containing the data
# """

# if version == "total_thickness":
# url = "https://www.usap-dc.org/dataset/usap-dc/601242/2020-01-10T17:37:09.5Z/DICE_Total_IceThickness_Das_JGR2020.txt" # noqa: E501
# fname = "DICE_Total_IceThickness_Das_JGR2020.txt"
# # known_hash="md5:615463dbf98d7a44ce1d36b0a66f49a3"
# known_hash = None

# path = pooch.retrieve(
# url=url,
# fname=fname,
# path=f"{pooch.os_cache('pooch')}/polartoolkit/ROSETTA_radar_data",
# known_hash=known_hash,
# progressbar=True,
# )
# df = pd.read_csv(path)

# elif version == "basal_melt":
# url = "https://www.usap-dc.org/dataset/usap-dc/601242/2020-01-10T17:37:09.5Z/BasalMelt_Das_JGR2020.txt" # noqa: E501
# fname = "BasalMelt_Das_JGR2020.txt"
# # known_hash="md5:08c5ae638cb72cf81ac022d58f7df7a9"
# known_hash = None

# path = pooch.retrieve(
# url=url,
# fname=fname,
# path=f"{pooch.os_cache('pooch')}/polartoolkit/ROSETTA_radar_data",
# known_hash=known_hash,
# progressbar=True,
# )
# df = pd.read_csv(
# path,
# header=None,
# delim_whitespace=True,
# names=["lon", "lat", "melt"],
# )

# # re-project to polar stereographic
# transformer = Transformer.from_crs("epsg:4326", "epsg:3031")
# df["easting"], df["northing"] = transformer.transform(
# df.lat.tolist(), df.lon.tolist()
# )

# elif version == "basal_melt_error":
# url = "https://www.usap-dc.org/dataset/usap-dc/601242/2020-01-10T17:37:09.5Z/ErrorAnalysis_BasalMelt_Das_JGR2020.txt" # noqa: E501
# fname = "ErrorAnalysis_BasalMelt_Das_JGR2020.txt"
# # known_hash="md5:23d99479dd6a3d1358b9f3b62c6738c0"
# known_hash = None

# path = pooch.retrieve(
# url=url,
# fname=fname,
# path=f"{pooch.os_cache('pooch')}/polartoolkit/ROSETTA_radar_data",
# known_hash=known_hash,
# progressbar=True,
# )
# df = pd.read_csv(path)

# return df


def magnetics(
version: str,
region: tuple[float, float, float, float] | None = None,
Expand Down
62 changes: 0 additions & 62 deletions tests/test_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,68 +915,6 @@ def test_gravity(test_input, expected):
# utils.get_grid_info(grid)


# %% ROSETTA radar


# @pytest.mark.fetch
# def test_rosetta_radar():
# df = fetch.rosetta_radar_data()
# # expected = [
# # 547.0122703054126,
# # -80.63749846487134,
# # -43.287329630685,
# # 1448416752.058848,
# # -100568.55304355593,
# # -987321.56515563,
# # 789.0193522081788,
# # -0.6843365719042627,
# # ]
# print(df.describe().iloc[1].tolist())
# # assert df.describe().iloc[1].tolist() == pytest.approx(expected, rel=0.1)


# %% ROSETTA magnetics


@pytest.mark.fetch()
def test_rosetta_magnetics():
df = fetch.rosetta_magnetics()
expected = [
547.0122703054126,
-80.63749846487134,
-43.287329630685,
1448416752.058848,
-100568.55304355593,
-987321.56515563,
789.0193522081788,
-0.6843365719042627,
]
assert df.describe().iloc[1].tolist() == pytest.approx(expected, rel=0.1)


# %% ROSETTA gravity


@pytest.mark.fetch()
def test_rosetta_gravity():
df = fetch.rosetta_gravity()
expected = [
661.2195503654474,
-80.57119757556714,
-36.74185651880941,
1457514923.0469708,
793.0566192217011,
-84278.81094301463,
-1000705.4912593851,
-40.83496413480705,
]
assert df.describe().iloc[1].tolist() == pytest.approx(expected, rel=0.1)


# df = fetch.rosetta_gravity()
# # get mean values of each column
# df.describe().iloc[1].tolist()

# %% magnetics

magnetics_test = [
Expand Down

0 comments on commit 4dadc7c

Please sign in to comment.