Skip to content

Commit

Permalink
Rename files based on new library name
Browse files Browse the repository at this point in the history
  • Loading branch information
awarde96 committed May 22, 2024
1 parent 6ba11eb commit b2d9b83
Show file tree
Hide file tree
Showing 43 changed files with 85 additions and 85 deletions.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions covjsonkit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import covjsonkit.api
import covjsonkit.decoder.TimeSeries
import covjsonkit.decoder.VerticalProfile
import covjsonkit.encoder.TimeSeries
import covjsonkit.encoder.VerticalProfile
64 changes: 64 additions & 0 deletions covjsonkit/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import covjsonkit.decoder.BoundingBox
import covjsonkit.decoder.Frame
import covjsonkit.decoder.Path
import covjsonkit.decoder.Shapefile
import covjsonkit.decoder.TimeSeries
import covjsonkit.decoder.VerticalProfile
import covjsonkit.decoder.Wkt
import covjsonkit.encoder.BoundingBox
import covjsonkit.encoder.Frame
import covjsonkit.encoder.Path
import covjsonkit.encoder.Shapefile
import covjsonkit.encoder.TimeSeries
import covjsonkit.encoder.VerticalProfile
import covjsonkit.encoder.Wkt

features_encoder = {
"pointseries": covjsonkit.encoder.TimeSeries.TimeSeries,
"verticalprofile": covjsonkit.encoder.VerticalProfile.VerticalProfile,
"boundingbox": covjsonkit.encoder.BoundingBox.BoundingBox,
"shapefile": covjsonkit.encoder.Shapefile.Shapefile,
"frame": covjsonkit.encoder.Frame.Frame,
"path": covjsonkit.encoder.Path.Path,
"wkt": covjsonkit.encoder.Wkt.Wkt,
}
features_decoder = {
"pointseries": covjsonkit.decoder.TimeSeries.TimeSeries,
"verticalprofile": covjsonkit.decoder.VerticalProfile.VerticalProfile,
"boundingbox": covjsonkit.decoder.BoundingBox.BoundingBox,
"shapefile": covjsonkit.decoder.Shapefile.Shapefile,
"frame": covjsonkit.decoder.Frame.Frame,
"path": covjsonkit.decoder.Path.Path,
"wkt": covjsonkit.decoder.Wkt.Wkt,
}


class Eccovjson:
def __init__(self):
pass

def encode(self, type, domaintype):
if domaintype == "timeseries":
domaintype = "PointSeries"
elif domaintype == "trajectory":
domaintype = "path"
feature = self._feature_factory(domaintype.lower(), "encoder")
return feature(type, domaintype)

def decode(self, covjson):
requesttype = covjson["domainType"]
if requesttype == "timeseries":
requesttype = "PointSeries"
elif requesttype == "MultiPoint":
requesttype = "boundingbox"
elif requesttype == "Trajectory":
requesttype = "path"
feature = self._feature_factory(requesttype.lower(), "decoder")
return feature(covjson)

def _feature_factory(self, feature_type, encoder_decoder):
if encoder_decoder == "encoder":
features = features_encoder
elif encoder_decoder == "decoder":
features = features_decoder
return features[feature_type]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import json
from abc import ABC, abstractmethod

from eccovjson.Coverage import Coverage
from eccovjson.CoverageCollection import CoverageCollection
from covjsonkit.Coverage import Coverage
from covjsonkit.CoverageCollection import CoverageCollection


class Decoder(ABC):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from covjson_pydantic.reference_system import ReferenceSystemConnectionObject

# from eccovjson.CoverageCollection import CoverageCollection
from eccovjson.param_db import get_param_from_db, get_unit_from_db
from covjsonkit.param_db import get_param_from_db, get_unit_from_db


class Encoder(ABC):
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions covjsonkit/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.0.6"
5 changes: 0 additions & 5 deletions eccovjson/__init__.py

This file was deleted.

64 changes: 0 additions & 64 deletions eccovjson/api.py

This file was deleted.

1 change: 0 additions & 1 deletion eccovjson/version.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_decoder_bounding_box.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# from earthkit import data

from eccovjson.decoder import BoundingBox
from covjsonkit.decoder import BoundingBox


class TestDecoder:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_decoder_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# import xarray as xr
# from earthkit import data

from eccovjson.decoder import Frame
from covjsonkit.decoder import Frame


class TestDecoder:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_decoder_shapefile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# from earthkit import data

from eccovjson.decoder import Shapefile
from covjsonkit.decoder import Shapefile


class TestDecoder:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_decoder_time_series.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# from earthkit import data

from eccovjson.api import Eccovjson
from covjsonkit.api import Eccovjson


class TestDecoder:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_decoder_vertical_profile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from eccovjson.api import Eccovjson
from covjsonkit.api import Eccovjson


class TestDecoder:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_decoder_wkt.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# from earthkit import data

from eccovjson.decoder import Wkt
from covjsonkit.decoder import Wkt


class TestDecoder:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_encoder_bounding_box.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from covjson_pydantic.coverage import CoverageCollection
from covjson_pydantic.domain import DomainType

from eccovjson.api import Eccovjson
from covjsonkit.api import Eccovjson


def get_timestamps(start_dt, end_dt, delta):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_encoder_frame.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from covjson_pydantic.coverage import CoverageCollection
from covjson_pydantic.domain import DomainType

from eccovjson.api import Eccovjson
from covjsonkit.api import Eccovjson


def get_timestamps(start_dt, end_dt, delta):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_encoder_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from covjson_pydantic.coverage import CoverageCollection
from covjson_pydantic.domain import DomainType

from eccovjson.api import Eccovjson
from covjsonkit.api import Eccovjson


def get_timestamps(start_dt, end_dt, delta):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_encoder_shapefile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from covjson_pydantic.coverage import CoverageCollection
from covjson_pydantic.domain import DomainType

from eccovjson.api import Eccovjson
from covjsonkit.api import Eccovjson


def get_timestamps(start_dt, end_dt, delta):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_encoder_time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from covjson_pydantic.coverage import CoverageCollection
from covjson_pydantic.domain import DomainType

from eccovjson.api import Eccovjson
from covjsonkit.api import Eccovjson


def get_timestamps(start_dt, end_dt, delta):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_encoder_wkt.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from covjson_pydantic.coverage import CoverageCollection
from covjson_pydantic.domain import DomainType

from eccovjson.api import Eccovjson
from covjsonkit.api import Eccovjson


def get_timestamps(start_dt, end_dt, delta):
Expand Down

0 comments on commit b2d9b83

Please sign in to comment.