Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
python -m pip install --upgrade pip

# Retry 3 times before the steps actually fails because sometimes it takes a minute for pip to recognize the new version
(echo "pip Install Attempt: 1" && pip install --force unity_py==${{ needs.release.outputs.publishedVersion }}) || \
(echo "pip Install Attempt: 2" && pip install --force unity_py==${{ needs.release.outputs.publishedVersion }}) || \
(echo "pip Install Attempt: 3" && pip install --force unity_py==${{ needs.release.outputs.publishedVersion }}) || \
(echo "pip Install Attempt: 1" && pip install --force unity-sds-client==${{ needs.release.outputs.publishedVersion }}) || \
(echo "pip Install Attempt: 2" && pip install --force unity-sds-client==${{ needs.release.outputs.publishedVersion }}) || \
(echo "pip Install Attempt: 3" && pip install --force unity-sds-client==${{ needs.release.outputs.publishedVersion }}) || \
(echo "pip Install Step Failed" && exit 1)
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

--------



## [0.2.0] - 2023-08-10
### Added
* Added parsing of collection in stac items
### Fixed
* fixed release workflow to test against `unity-sds-client` not `unity_py`
### Changed
* updated package name so that imports reference `unity_sds_client` not `unity_py`
### Removed
### Security
### Deprecated

## [0.1.2] - 2023-06-28

### Added
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Unity-Py is a Python client to simplify interactions with NASA's Unity Platform.

## Installation

### Install from pypi
```
pip install unity-sds-client
```

### Install from Github
```
python -m pip install git+https://github.com/unity-sds/unity-py.git
Expand Down Expand Up @@ -36,9 +41,9 @@ The order of Authentication Parameters is as follows:
### Running your first command

```
from unity_py.unity import Unity
from unity_py.unity_session import UnitySession
from unity_py.unity_services import UnityServices as services
from unity_sds_client.unity import Unity
from unity_sds_client.unity_session import UnitySession
from unity_sds_client.unity_services import UnityServices as services

s = Unity()
dataManager = s.client(services.DATA_SERVICE)
Expand Down
2 changes: 1 addition & 1 deletion notebooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## mercury-dashboard.ipynb

An example notebook using the unity-py client to create a pseudo operator dashboard. Proof of concept and a way of defining what items need to be in the client, and what metadata/data services need to return.
An example notebook using the unity-sds-client Python package to create a pseudo operator dashboard. Proof of concept and a way of defining what items need to be in the client, and what metadata/data services need to return.

### requirements
```
Expand Down
53 changes: 45 additions & 8 deletions notebooks/mercury-dashboard.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[tool.poetry]
name = "unity-sds-client"
version = "0.1.2"
version = "0.2.0"
description = "Unity-Py is a Python client to simplify interactions with NASA's Unity Platform."
authors = ["Anil Natha, Mike Gangl"]
readme = "README.md"
license = "Apache-2.0"
repository = "https://github.com/unity-sds/unity-py"
exclude = ['img', 'tests']
packages = [
{ include = "unity_py" },
{ include = "unity_sds_client" },
]

[tool.poetry.dependencies]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"type": "Feature",
"stac_version": "1.0.0",
"collection": "collection_test",
"id": "SNDR.SS1330.CHIRP.20160829T2317.m06.g233.L1_AQ.std.v02_48.G.200425130422",
"properties": {
"datetime": "2016-08-29T23:17:00Z",
Expand Down
6 changes: 3 additions & 3 deletions tests/test_unity_py.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unity_py.unity import Unity
from unity_py.unity_session import UnitySession
from unity_py.unity_services import UnityServices as services
from unity_sds_client.unity import Unity
from unity_sds_client.unity_session import UnitySession
from unity_sds_client.unity_services import UnityServices as services

import pytest

Expand Down
11 changes: 9 additions & 2 deletions tests/test_unity_stac.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from unity_py.unity_exception import UnityException
from unity_py.resources.collection import Collection, Dataset, DataFile
from unity_sds_client.unity_exception import UnityException
from unity_sds_client.resources.collection import Collection, Dataset, DataFile
import datetime
import pytest
import os
Expand All @@ -23,6 +23,9 @@ def test_read_stac():
datasets = collection.datasets
assert len(datasets) == 2

# Added 8/10/23 to check the STAC collection information
assert datasets[1].collection_id == 'C2011289787-GES_DISC'

data_files = collection.data_locations()
assert len(data_files) == 6
data_files = collection.data_locations(["data","opendap"])
Expand All @@ -37,6 +40,8 @@ def test_read_stac():
#Try a "classic" catalog + item files stac catalog
collection = Collection.from_stac("tests/test_files/catalog_01.json")
datasets = collection.datasets
# Added 8/10/23 to check the STAC collection information
assert datasets[0].collection_id == 'collection_test'
assert len(datasets) == 1
data_files = collection.data_locations()
assert len(data_files) == 2
Expand Down Expand Up @@ -102,6 +107,8 @@ def test_unity_to_stac():
prop_count = 0

for d in collection._datasets:
# Added 8/10/23 to check the STAC collection information
assert d.collection_id == 'SNDR13CHRP1AQCal_rebin'
for df in d.datafiles:
assert application_output_directory in df.location
assert os.path.isabs(df.location) == True
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unity_py.unity_exception import UnityException
from unity_py.resources.dataset import Dataset
from unity_py.resources.data_file import DataFile
from unity_sds_client.unity_exception import UnityException
from unity_sds_client.resources.dataset import Dataset
from unity_sds_client.resources.data_file import DataFile
from pystac import Catalog, get_stac_version, ItemCollection, Item, Asset
from pystac.errors import STACTypeError
import json
Expand All @@ -17,7 +17,7 @@ class Collection(object):
"""

def __str__(self):
return f'unity_py.resources.Collection(collection_id={self.collection_id})'
return f'unity_sds_client.resources.Collection(collection_id={self.collection_id})'

def __repr__(self):
return self.__str__()
Expand Down Expand Up @@ -88,6 +88,7 @@ def to_stac(collection, data_dir):
id=dataset.id,
geometry=dataset.geometry,
bbox=dataset.bbox,
collection=dataset.collection_id,
datetime = date_parser.parse(dataset.data_begin_time),
properties={
"datetime": dataset.data_begin_time,
Expand Down Expand Up @@ -163,7 +164,17 @@ def from_stac(stac_file):
collection = Collection(id)
# Catch file not found... ?
for item in items:
ds = Dataset(item.id, item.properties.get("collection"), item.properties.get("start_datetime",None), item.properties.get("end_datetime", None), item.properties.get("created", None))
# if the id of the catalog and the id of the collection items are not the same,
# then use the one that is a part of the collection item definition
# Added 8/10/23
ds = Dataset(item.id, id, item.properties.get("start_datetime", None),
item.properties.get("end_datetime", None), item.properties.get("created", None))
if item.collection_id is not None and item.collection_id != id:
print ("if2")
ds = Dataset(item.id, item.collection_id, item.properties.get("start_datetime", None),
item.properties.get("end_datetime", None), item.properties.get("created", None))


ds.bbox = item.bbox
ds.geometry = item.geometry

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class DataFile(object):
"""

def __str__(self):
return f'unity_py.resources.DataFile(location={self.location})'
return f'unity_sds_client.resources.DataFile(location={self.location})'

def __repr__(self):
return self.__str__()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from unity_py.resources.data_file import DataFile
from unity_sds_client.resources.data_file import DataFile

class Dataset(object):
"""The Dataset object contains metadata about a collection within the Unity system, and also is a container for the data_files within a dataset.
Expand All @@ -7,7 +7,7 @@ class Dataset(object):
"""

def __str__(self):
return f'unity_py.resources.Dataset(data_id={self.id})'
return f'unity_sds_client.resources.Dataset(data_id={self.id})'

def __repr__(self):
return self.__str__()
Expand Down Expand Up @@ -50,7 +50,7 @@ def add_data_file(self, datafile: type=DataFile):
Parameters
----------
datafile : DataFile
a unity_py.resource.datafile object containing the location of data products.
a unity_sds_client.resource.datafile object containing the location of data products.

"""
self.datafiles.append(datafile)
Expand Down
10 changes: 5 additions & 5 deletions unity_py/resources/job.py → unity_sds_client/resources/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
from typing import TYPE_CHECKING
import requests

from unity_py.unity_session import UnitySession
from unity_py.resources.job_status import JobStatus
from unity_py.utils.http import get_headers
from unity_sds_client.unity_session import UnitySession
from unity_sds_client.resources.job_status import JobStatus
from unity_sds_client.utils.http import get_headers

if TYPE_CHECKING:
from unity_py.resources.process import Process
from unity_sds_client.resources.process import Process


class Job(object):

def __str__(self):
return '''unity_py.resources.Job(
return '''unity_sds_client.resources.Job(
id="{}",
status="{}",
inputs={}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import requests
from unity_py.unity_session import UnitySession
from unity_py.resources.job import Job
from unity_py.utils.http import get_headers
from unity_sds_client.unity_session import UnitySession
from unity_sds_client.resources.job import Job
from unity_sds_client.utils.http import get_headers

class Process(object):

def __str__(self):
return '''unity_py.resources.Process(
return '''unity_sds_client.resources.Process(
id="{}",
title="{}",
abstract="{}",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import requests
from unity_py.unity_session import UnitySession
from unity_py.resources.collection import Collection
from unity_py.resources.dataset import Dataset
from unity_py.resources.data_file import DataFile
from unity_sds_client.unity_session import UnitySession
from unity_sds_client.resources.collection import Collection
from unity_sds_client.resources.dataset import Dataset
from unity_sds_client.resources.data_file import DataFile


class DataService(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import requests
from typing import List

from unity_py.unity_session import UnitySession
from unity_py.resources.process import Process
from unity_py.resources.job import Job, JobStatus
from unity_py.utils.http import get_headers
from unity_sds_client.unity_session import UnitySession
from unity_sds_client.resources.process import Process
from unity_sds_client.resources.job import Job, JobStatus
from unity_sds_client.utils.http import get_headers

class ProcessService(object):
"""
Expand Down
12 changes: 6 additions & 6 deletions unity_py/unity.py → unity_sds_client/unity.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import os
from configparser import ConfigParser, ExtendedInterpolation
from unity_py.services.data_service import DataService
from unity_py.services.process_service import ProcessService
from unity_py.unity_session import UnitySession
from unity_py.unity_exception import UnityException
from unity_py.unity_environments import UnityEnvironments
from unity_py.unity_services import UnityServices
from unity_sds_client.services.data_service import DataService
from unity_sds_client.services.process_service import ProcessService
from unity_sds_client.unity_session import UnitySession
from unity_sds_client.unity_exception import UnityException
from unity_sds_client.unity_environments import UnityEnvironments
from unity_sds_client.unity_services import UnityServices


class Unity(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class UnityServices(Enum):
"""
The UnityServices class is used to specify a service, when needed, when interacting with the unity_py library.
The UnityServices class is used to specify a service, when needed, when interacting with the unity_sds_client package.
"""

DATA_SERVICE = "data_service"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import requests

from configparser import ConfigParser
from unity_py.unity_environments import UnityEnvironments
from unity_sds_client.unity_environments import UnityEnvironments


class UnitySession(object):
Expand Down
File renamed without changes.