Skip to content

Commit

Permalink
Merge branch 'development' into read_arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaS11 authored Oct 18, 2023
2 parents 1242881 + a1a723d commit 5f8589a
Show file tree
Hide file tree
Showing 7 changed files with 286 additions and 273 deletions.
2 changes: 1 addition & 1 deletion doc/source/example_notebooks/IS2_data_access.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"\n",
"There are three required inputs, depending on how you want to search for data. Two are required in all cases:\n",
"- `short_name` = the data product of interest, known as its \"short name\".\n",
"See https://nsidc.org/data/icesat-2/data-sets for a list of the available data products.\n",
"See https://nsidc.org/data/icesat-2/products for a list of the available data products.\n",
"- `spatial extent` = a region of interest to search within. This can be entered as a bounding box, polygon vertex coordinate pairs, or a polygon geospatial file (currently shp, kml, and gpkg are supported).\n",
" - bounding box: Given in decimal degrees for the lower left longitude, lower left latitude, upper right longitude, and upper right latitude\n",
" - polygon vertices: Given as longitude, latitude coordinate pairs of decimal degrees with the last entry a repeat of the first.\n",
Expand Down
300 changes: 150 additions & 150 deletions doc/source/user_guide/documentation/classes_dev_uml.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
206 changes: 103 additions & 103 deletions doc/source/user_guide/documentation/classes_user_uml.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 14 additions & 9 deletions icepyx/core/is2ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,11 @@ def _default_varlists(product):
return common_list


# dev goal: check and test this function
def gt2spot(gt, sc_orient):
warnings.warn(
"icepyx versions 0.8.0 and earlier used an incorrect spot number calculation."
"As a result, computations depending on spot number may be incorrect and should be redone."
)

assert gt in [
"gt1l",
Expand All @@ -281,39 +284,41 @@ def gt2spot(gt, sc_orient):
gr_num = np.uint8(gt[2])
gr_lr = gt[3]

# spacecraft oriented forward
if sc_orient == 1:
if gr_num == 1:
if gr_lr == "l":
spot = 2
spot = 6
elif gr_lr == "r":
spot = 1
spot = 5
elif gr_num == 2:
if gr_lr == "l":
spot = 4
elif gr_lr == "r":
spot = 3
elif gr_num == 3:
if gr_lr == "l":
spot = 6
spot = 2
elif gr_lr == "r":
spot = 5
spot = 1

# spacecraft oriented backward
elif sc_orient == 0:
if gr_num == 1:
if gr_lr == "l":
spot = 5
spot = 1
elif gr_lr == "r":
spot = 6
spot = 2
elif gr_num == 2:
if gr_lr == "l":
spot = 3
elif gr_lr == "r":
spot = 4
elif gr_num == 3:
if gr_lr == "l":
spot = 1
spot = 5
elif gr_lr == "r":
spot = 2
spot = 6

if "spot" not in locals():
raise ValueError("Could not compute the spot number.")
Expand Down
9 changes: 8 additions & 1 deletion icepyx/core/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import concurrent.futures
import datetime
import re
import warnings

import backoff
import dask.array as da
Expand Down Expand Up @@ -332,7 +333,13 @@ def request_OA_data(self, paras) -> da.array:
A dask array containing the ICESat-2 elevation data.
"""

base_url = "https://openaltimetry.org/data/api/icesat2/level3a"
warnings.warn(
"NOTICE: visualizations requiring the OpenAltimetry API are currently (October 2023) "
"unavailable while hosting of OpenAltimetry transitions from UCSD to NSIDC."
"A ticket has been issued to restore programmatic API access."
)

base_url = "http://openaltimetry.earthdatacloud.nasa.gov/data/api/icesat2"
trackId, Date, cycle, bbox, product = paras

# Generate API
Expand Down
16 changes: 8 additions & 8 deletions icepyx/tests/test_is2ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,12 +556,12 @@ def test_unsupported_default_varlist():
def test_gt2spot_sc_orient_1():
# gt1l
obs = is2ref.gt2spot("gt1l", 1)
expected = 2
expected = 6
assert obs == expected

# gt1r
obs = is2ref.gt2spot("gt1r", 1)
expected = 1
expected = 5
assert obs == expected

# gt2l
Expand All @@ -576,24 +576,24 @@ def test_gt2spot_sc_orient_1():

# gt3l
obs = is2ref.gt2spot("gt3l", 1)
expected = 6
expected = 2
assert obs == expected

# gt3r
obs = is2ref.gt2spot("gt3r", 1)
expected = 5
expected = 1
assert obs == expected


def test_gt2spot_sc_orient_0():
# gt1l
obs = is2ref.gt2spot("gt1l", 0)
expected = 5
expected = 1
assert obs == expected

# gt1r
obs = is2ref.gt2spot("gt1r", 0)
expected = 6
expected = 2
assert obs == expected

# gt2l
Expand All @@ -608,10 +608,10 @@ def test_gt2spot_sc_orient_0():

# gt3l
obs = is2ref.gt2spot("gt3l", 0)
expected = 1
expected = 5
assert obs == expected

# gt3r
obs = is2ref.gt2spot("gt3r", 0)
expected = 2
expected = 6
assert obs == expected
3 changes: 2 additions & 1 deletion icepyx/tests/test_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_gran_paras(filename, expect):

# 2023-01-27: for the commented test below, r (in visualization line 444) is returning None even though I can see OA data there via a browser


"""
@pytest.mark.parametrize(
"product, date_range, bbox, expect",
[
Expand Down Expand Up @@ -112,3 +112,4 @@ def test_visualization_orbits(product, bbox, cycles, tracks, expect):
data_size = region_viz.parallel_request_OA().size
assert data_size == expect
"""

0 comments on commit 5f8589a

Please sign in to comment.