Skip to content

Commit

Permalink
fixing netrc #196
Browse files Browse the repository at this point in the history
  • Loading branch information
betolink committed Jan 27, 2023
1 parent 3ac133a commit 6355597
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@ on:
jobs:
documentation:
runs-on: ubuntu-latest

defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v3
uses: mamba-org/provision-with-micromamba@main
with:
python-version: 3.9
channels: conda-forge
mamba-version: "*"
activate-environment: earthaccess-dev
environment-file: binder/environment-dev.yml
activate-name: earthaccess-dev
- name: Get full python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
Expand Down
7 changes: 4 additions & 3 deletions earthaccess/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def search_data(
return query.get_all()


def login(strategy: str = "interactive") -> Auth:
def login(strategy: str = "interactive", persist: bool = False) -> Auth:
"""Authenticate with Earthdata login (https://urs.earthdata.nasa.gov/)
Parameters:
Expand All @@ -122,8 +122,9 @@ def login(strategy: str = "interactive") -> Auth:
Returns:
an instance of Auth.
"""
earthaccess.__auth__.login(strategy=strategy)
earthaccess.__store__ = Store(earthaccess.__auth__)
earthaccess.__auth__.login(strategy=strategy, persist=persist)
if earthaccess.__auth__ is not None:
earthaccess.__store__ = Store(earthaccess.__auth__)
return earthaccess.__auth__


Expand Down
14 changes: 13 additions & 1 deletion earthaccess/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,19 @@ def size(self) -> float:
]
)
except Exception:
total_size = 0
try:
total_size = sum(
[
float(s["SizeInBytes"])
for s in self[
"umm.DataGranule.ArchiveAndDistributionInformation"
]
if "ArchiveAndDistributionInformation"
in self["umm"]["DataGranule"]
]
) / (1024 * 1024)
except Exception:
total_size = 0
return total_size

def _derive_s3_link(self, links: List[str]) -> List[str]:
Expand Down
Empty file.

0 comments on commit 6355597

Please sign in to comment.