Skip to content

Commit

Permalink
Bug fixes for netcdf files, and more
Browse files Browse the repository at this point in the history
  • Loading branch information
spestana committed Sep 24, 2024
1 parent 52f9452 commit bdcfe9e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 11 deletions.
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ dependencies = [
"pathlib",
"requests",
"rasterio",
"netcdf4",
"netCDF4",
"h5netcdf",
"zarr",
"dask",
"awscli",
"s3fs",
"pydap",
"cftime",
"cfgrib",
"pooch",
"fsspec",
"gdown",
"aiohttp",
Expand Down
11 changes: 9 additions & 2 deletions src/goes_ortho/Downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ def ABI_Downloader(home, bucket, year, month, day, hour, product, channel): # n
product = can be a List or a single string for ABI sensors products from GOES satellite next-generation example: ["ABI-L2-CMIPF"] or "ABI-L1b-RadF"
channel = Required only for "ABI-L1b-Rad" and "ABI-L2-CMIP" products. Can be a List or a single string for the channels from ABI sensors. Example = ['01','02'] or "13" (channel is ignored for other ABI products)
"""
from goes_ortho import boto3, botocore, checkData

import boto3
import botocore

from goes_ortho import checkData
from goes_ortho.utils import ProgressPercentage, __isAList

julianDay = ""
Expand Down Expand Up @@ -146,7 +150,10 @@ def GLM_Downloader(home, bucket, year, month, day, hour):
day = type List for day date: example = ['10','20','30']
hour = type List for hour need be UTC coordinate time date: example = ['06','12','18']"""

from goes_ortho import boto3, botocore, checkData
import boto3
import botocore

from goes_ortho import checkData
from goes_ortho.utils import ProgressPercentage, __isAList

julianDay = ""
Expand Down
12 changes: 12 additions & 0 deletions src/goes_ortho/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
from . import (
Downloader,
checkData,
clip,
geometry,
get_data,
io,
orthorectify,
rad,
timeseries,
utils,
)
from .version import version as __version__

__all__ = [
Expand Down
7 changes: 3 additions & 4 deletions src/goes_ortho/checkData.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ def createPathGoesData(home, bucket, year, month, day, product, hour, channel=No
"""Function used create a directory, with the calendar date the user give to function"""

import errno

from goes_ortho import os
import os

pathReturn = ""
"""that part will get your home directory and the Satellite bucket you're getting your dataset
Expand Down Expand Up @@ -62,7 +61,7 @@ def checkFiles(path, singleFile):
The singleFile is the filename from the data in the bucket 'noaa-goes16'
and will check the singleFile exists on the created path
"""
from goes_ortho import os
import os

if os.path.isfile("{0}/{1}".format(path, singleFile)):
return True
Expand All @@ -86,7 +85,7 @@ def checkSize(path, singleFile, singleSize):
"""

from goes_ortho import os
import os

if checkFiles(path, singleFile):
if os.path.getsize(path + singleFile) == singleSize:
Expand Down
2 changes: 1 addition & 1 deletion src/goes_ortho/clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def subsetNetCDF(filepath, bounds, newfilepath=None):
lon_east = bounds[2]
lat_north = bounds[3]

with xr.open_dataset(filepath, engine="h5netcdf") as file:
with xr.open_dataset(filepath) as file:
print(file)
f = file.load()
# Values needed for geometry calculations
Expand Down
6 changes: 3 additions & 3 deletions src/goes_ortho/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


def daytoJulian(year, month, day):
from goes_ortho import datetime
import datetime

i, j, k = 0, 0, 0
julianDay = []
Expand Down Expand Up @@ -66,15 +66,15 @@ def __isAList(year, month, day, product, hour, channel=None, julianDay=None):

class ProgressPercentage(object):
def __init__(self, filename, objectSize):
from goes_ortho import threading
import threading

self._filename = filename
self._size = objectSize
self._seen_so_far = 0
self._lock = threading.Lock()

def __call__(self, bytes_amount):
from goes_ortho import sys
import sys

# To simplify we'll assume this is hooked up
# to a single filename.
Expand Down

0 comments on commit bdcfe9e

Please sign in to comment.