Skip to content

Commit

Permalink
Merge pull request #37 from spestana/download-refactor
Browse files Browse the repository at this point in the history
Download refactor
  • Loading branch information
spestana authored Sep 26, 2024
2 parents 2869010 + a560e19 commit ea2e4ad
Show file tree
Hide file tree
Showing 8 changed files with 1,006 additions and 2,145 deletions.
682 changes: 682 additions & 0 deletions docs/examples/download.ipynb

Large diffs are not rendered by default.

19 changes: 0 additions & 19 deletions docs/examples/example.json

This file was deleted.

2,038 changes: 7 additions & 2,031 deletions docs/examples/quick_start.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

installation
examples/quick_start
examples/download
examples/subset_abi_netcdf_example
examples/orthorectify_abi_example
examples/orthorectify_abi_example2
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies = [
"aiohttp",
"scipy",
"geopandas",
"geojson",
"folium",
"distributed",
"tqdm",
Expand All @@ -43,6 +44,7 @@ dependencies = [
"flake8",
"scikit-learn",
"geogif",
"goes2go",
]
requires-python = ">=3.8"
authors = [
Expand Down
13 changes: 7 additions & 6 deletions src/goes_ortho/clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Functions for clipping GOES ABI imagery to smaller areas
"""

import logging

import xarray as xr

from goes_ortho.geometry import LonLat2ABIangle
Expand Down Expand Up @@ -40,7 +42,6 @@ def subsetNetCDF(filepath, bounds, newfilepath=None):
lat_north = bounds[3]

with xr.open_dataset(filepath) as file:
print(file)
f = file.load()
# Values needed for geometry calculations
req = f.goes_imager_projection.semi_major_axis
Expand All @@ -56,27 +57,27 @@ def subsetNetCDF(filepath, bounds, newfilepath=None):
x_rad_sw, y_rad_sw = LonLat2ABIangle(
lon_west, lat_south, 0, H, req, rpol, e, lon_0
)
print("SW Corner: {}, {}".format(x_rad_sw, y_rad_sw))
logging.info("SW Corner: {}, {}".format(x_rad_sw, y_rad_sw))
x_rad_se, y_rad_se = LonLat2ABIangle(
lon_east, lat_south, 0, H, req, rpol, e, lon_0
)
print("SE Corner: {}, {}".format(x_rad_se, y_rad_se))
logging.info("SE Corner: {}, {}".format(x_rad_se, y_rad_se))
x_rad_nw, y_rad_nw = LonLat2ABIangle(
lon_west, lat_north, 0, H, req, rpol, e, lon_0
)
print("NW Corner: {}, {}".format(x_rad_nw, y_rad_nw))
logging.info("NW Corner: {}, {}".format(x_rad_nw, y_rad_nw))
x_rad_ne, y_rad_ne = LonLat2ABIangle(
lon_east, lat_north, 0, H, req, rpol, e, lon_0
)
print("NE Corner: {}, {}".format(x_rad_ne, y_rad_ne))
logging.info("NE Corner: {}, {}".format(x_rad_ne, y_rad_ne))
# choose the bounds that cover the largest extent
y_rad_s = min(
y_rad_sw, y_rad_se
) # choose southern-most coordinate (scan angle in radians)
y_rad_n = max(y_rad_nw, y_rad_ne) # northern-most
x_rad_e = max(x_rad_se, x_rad_ne) # eastern-most (scan angle in radians)
x_rad_w = min(x_rad_sw, x_rad_nw) # western-most
print(
logging.info(
"Corner coords chosen: N: {}, S: {}; E: {}, W: {}".format(
y_rad_n, y_rad_s, x_rad_e, x_rad_w
)
Expand Down
Loading

0 comments on commit ea2e4ad

Please sign in to comment.