Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module 'itslivetools' has no attribute #3

Open
00000321 opened this issue Aug 19, 2023 · 1 comment
Open

module 'itslivetools' has no attribute #3

00000321 opened this issue Aug 19, 2023 · 1 comment

Comments

@00000321
Copy link

When analyzing glacier velocity with itslivetools several errors appeared and many methods were tried with no solution. The errors were "module 'itslivetools' has no attribute 'find_granule_by_point'" and "module 'itslivetools' has no attribute 'find_granule_by_point'". I wonder if there could be a better solution.

@e-marshall
Copy link
Owner

e-marshall commented Aug 21, 2023

hi @00000321 ! Thanks for raising this issue and sorry for the troubles you encountered. This package is undergoing significant changes at the moment and that function has been rewritten and is in a new location. The new version should be pushed soon, in the meantime you could use this version:

def find_granule_by_point(input_point, label='single_point'):
    '''returns url for the granule (zarr datacube) containing a specified point. point must be passed in epsg:4326
    '''
    catalog = gpd.read_file('https://its-live-data.s3.amazonaws.com/datacubes/catalog_v02.json')

    #make shapely point of input point
    p = gpd.GeoSeries([Point(input_point[0], input_point[1])],crs='EPSG:4326')
    #make gdf of point
    gdf = gdf = gpd.GeoDataFrame({'label': f'{label}', 
                                  'geometry':p})

    #find row of granule 
    granule = catalog.sjoin(gdf, how='inner')

    url = granule['zarr_url'].values[0]
    return url

Feel free to reach out if anything else comes up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants