Skip to content

Commit

Permalink
fixes flake8
Browse files Browse the repository at this point in the history
Signed-off-by: nagesh bansal <nageshbansal59@gmail.com>
  • Loading branch information
Nageshbansal committed Sep 18, 2023
1 parent ca041d8 commit 08d1f34
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
14 changes: 10 additions & 4 deletions neonwranglerpy/fetcher/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ async def _download(session, url, filename, sem, size=None):
# update_progressbar(progress, size)


async def _fetcher(data, rate_limit, headers, files_to_stack_path="filesToStack", data_type="vst"):
async def _fetcher(data,
rate_limit,
headers,
files_to_stack_path="filesToStack",
data_type="vst"):
"""Fetcher for downloading files."""
sem = asyncio.Semaphore(rate_limit)
data = data['data']
Expand All @@ -76,8 +80,9 @@ async def _fetcher(data, rate_limit, headers, files_to_stack_path="filesToStack"
sizes = [f['size'] for f in data["files"]]
f_names = [f['name'] for f in data["files"]]
if data_type == "vst":
dir_name = '.'.join(
['NEON', data['productCode'], data['siteCode'], data['month'], data['release']])
dir_name = '.'.join([
'NEON', data['productCode'], data['siteCode'], data['month'], data['release']
])
zip_dir_path = os.path.join(files_to_stack_path, f'{dir_name}')
if not os.path.isdir(zip_dir_path):
os.mkdir(zip_dir_path)
Expand Down Expand Up @@ -117,7 +122,8 @@ def fetcher(batch, data_type, rate_limit, headers, files_to_stack_path):
if data_type == 'vst':
asyncio.run(vst_fetcher(batch, rate_limit, headers, files_to_stack_path))
elif data_type == 'aop':
asyncio.run(_fetcher(batch, rate_limit, headers, files_to_stack_path, data_type))
asyncio.run(
_fetcher(batch, rate_limit, headers, files_to_stack_path, data_type))

except Exception as e:
print(f"Error processing URLs: {e}")
Expand Down
8 changes: 4 additions & 4 deletions neonwranglerpy/lib/retrieve_aop_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ def retrieve_aop_data(data, year=2019, dpID=['DP3.30006.001'], savepath=""):
"""
coords_for_tiles = data[['plotID', 'siteID', 'utmZone', 'easting', 'northing']]
# get tiles dimensions
coords_for_tiles['easting'] = (coords_for_tiles[['easting']] /
1000).astype(int, errors='ignore') * 1000
coords_for_tiles['northing'] = (coords_for_tiles[['northing']] /
1000).astype(int, errors='ignore') * 1000
coords_for_tiles['easting'] = (coords_for_tiles[['easting']] / 1000).astype(
int, errors='ignore') * 1000
coords_for_tiles['northing'] = (coords_for_tiles[['northing']] / 1000).astype(
int, errors='ignore') * 1000
# if there are more than 1 row, drop duplicates
if coords_for_tiles.easting.shape[0] > 1:
# drop duplicates values
Expand Down

0 comments on commit 08d1f34

Please sign in to comment.