Skip to content

Commit

Permalink
Merge branch 'main' into harmony-1892
Browse files Browse the repository at this point in the history
  • Loading branch information
vinnyinverso authored Nov 18, 2024
2 parents 5db814b + a293e72 commit 7147b60
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
12 changes: 7 additions & 5 deletions service-templates/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Add copyright statement here

FROM ghcr.io/osgeo/gdal:alpine-small-latest
FROM ghcr.io/osgeo/gdal:alpine-small-3.9.3

RUN apk add bash build-base gcc g++ gfortran openblas-dev cmake python3 python3-dev libffi-dev netcdf-dev libxml2-dev libxslt-dev libjpeg-turbo-dev zlib-dev hdf5 hdf5-dev gdal-dev gdal-tools

RUN python -m ensurepip --upgrade
RUN pip3 install gdal numpy netCDF4 matplotlib harmony-service-lib
RUN apk add bash build-base gcc g++ gfortran openblas-dev cmake python3 python3-dev libffi-dev netcdf-dev libxml2-dev libxslt-dev libjpeg-turbo-dev zlib-dev hdf5 hdf5-dev
RUN python3 -m venv service-env
ENV PATH="/service-env/bin:$PATH"
RUN python3 -m ensurepip --upgrade
RUN pip3 install numpy netCDF4 matplotlib harmony-service-lib
RUN pip3 install "gdal==3.9.3"

# Create a new user
RUN adduser -D -s /bin/sh -h /home/dockeruser -g "" -u 1000 dockeruser
Expand Down
14 changes: 7 additions & 7 deletions service-templates/sample_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from tempfile import mkdtemp
from pystac import Asset

import harmony
from harmony.util import generate_output_filename, stage, download
import harmony_service_lib
from harmony_service_lib.util import generate_output_filename, stage, download

class ExampleAdapter(harmony.BaseHarmonyAdapter):
class ExampleAdapter(harmony_service_lib.BaseHarmonyAdapter):
"""
Shows an example of what a service adapter implementation looks like
"""
Expand All @@ -31,7 +31,7 @@ def process_item(self, item, source):
----------
item : pystac.Item
the item that should be processed
source : harmony.message.Source
source : harmony_service_lib.message.Source
the input source defining the variables, if any, to subset from the item
Returns
Expand Down Expand Up @@ -109,12 +109,12 @@ def main():
"""
parser = argparse.ArgumentParser(prog='example', description='Run an example service')

harmony.setup_cli(parser)
harmony_service_lib.setup_cli(parser)

args = parser.parse_args()

if (harmony.is_harmony_cli(args)):
harmony.run_cli(parser, args, ExampleAdapter)
if (harmony_service_lib.is_harmony_cli(args)):
harmony_service_lib.run_cli(parser, args, ExampleAdapter)
else:
run_cli(args)

Expand Down

0 comments on commit 7147b60

Please sign in to comment.