Skip to content

Commit

Permalink
[brazil-data-cube#68] Review dependencies conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
AbnerErnaniADSFatec committed Sep 13, 2024
1 parent dc06a85 commit fd77e56
Show file tree
Hide file tree
Showing 14 changed files with 104 additions and 54 deletions.
55 changes: 55 additions & 0 deletions scripts/get-source-codes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#
# This file is part of Python QGIS Plugin for WTSS.
# Copyright (C) 2024 INPE.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
#

"""Python Script to list Path libraries."""

from pathlib import Path

lib_paths = []

import json
lib_paths.append(json.__file__)

import numpy
lib_paths.append(numpy.__file__)

import seaborn
lib_paths.append(seaborn.__file__)

import matplotlib
lib_paths.append(matplotlib.__file__)

import pandas
lib_paths.append(pandas.__file__)

import jsonschema
lib_paths.append(jsonschema.__file__)

import pystac
lib_paths.append(pystac.__file__)

import pystac_client
lib_paths.append(pystac_client.__file__)

import wtss
lib_paths.append(wtss.__file__)

file = open(Path('scripts') / 'lib-paths.txt','w')
for path in lib_paths:
file.write(str(path).replace('__init__.py', '') + "\n")
file.close()
40 changes: 0 additions & 40 deletions scripts/get_source_codes.py

This file was deleted.

File renamed without changes.
11 changes: 5 additions & 6 deletions scripts/build-zip.sh → scripts/linux/make-lib-path.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@
#
#!/bin/bash

LIB_PATH="./wtss_plugin/controller/lib"
LIB_PATH="./wtss_plugin/lib"
SCRIPTS_PATH="./scripts"

mkdir -p ./wtss_plugin/controller/lib
mkdir -p $LIB_PATH

cat $SCRIPTS_PATH/lib-paths.txt | while read path || [[ -n $path ]];
do
echo "Copying all dependencies for "$path" to "$LIB_PATH
cp -R $path ./wtss_plugin/controller/lib
cp -R $path $LIB_PATH
done

cd wtss_plugin

pb_tool zip
echo "Removing backends for matplotlib..."
rm -R $LIB_PATH/matplotlib/backends/web_backend/jquery
File renamed without changes.
28 changes: 28 additions & 0 deletions scripts/linux/run-qgis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# This file is part of Python QGIS Plugin for WTSS.
# Copyright (C) 2024 INPE.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
#

xhost +

docker run --rm --name="qgis-3-desktop" \
-i -t \
-v ${PWD}:/home/wtss_plugin \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
qgis/qgis qgis

xhost -
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@

install_requires = [
'numpy>=1.19',
'shapely>=2.0.6',
'matplotlib>=3.3.3',
'seaborn>=0.13.2',
'pandas>=1.1',
Expand Down
6 changes: 4 additions & 2 deletions wtss_plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ def classFactory(iface):
:param iface: A QGIS interface instance.
:type iface: QgsInterface
"""
import sys
# Setting PYTHONPATH to use dependencies
import os
import sys
from pathlib import Path
from .wtss_qgis import wtss_qgis
sys.path.append(str(Path(os.path.abspath(os.path.dirname(__file__))) / 'lib'))
# Start plugin GUI
from .wtss_qgis import wtss_qgis
return wtss_qgis(iface)
15 changes: 11 additions & 4 deletions wtss_plugin/controller/helpers/pystac_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import pandas
import pystac_client
import shapely.geometry
from osgeo import gdal
from qgis.core import QgsRasterLayer

Expand Down Expand Up @@ -66,6 +65,16 @@ def get_raster_vrt_folder(self) -> str:
'examples'
)

def get_point_reference(self) -> any:
"""Return the coordinates as Geojson."""
return {
"type": "Point",
"coordinates": [
self.longitude,
self.latitude
],
}

def update_raster_vrt_folder(self, new_raster_vrt_folder) -> None:
"""Update the location path to save virtual rasters."""
new_raster_vrt_folder = str(new_raster_vrt_folder)
Expand Down Expand Up @@ -111,11 +120,9 @@ def get_source_from_click(event):

service = pystac_client.Client.open(Config.STAC_HOST)

geometry = shapely.geometry.Point(stac_args.longitude, stac_args.latitude)

item_search = service.search(
collections = [stac_args.coverage],
intersects = geometry,
intersects = stac_args.get_point_reference(),
datetime = selected_time
)

Expand Down
2 changes: 1 addition & 1 deletion wtss_plugin/pb_tool.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ python_files: __init__.py wtss_qgis.py wtss_qgis_dialog.py
main_dialog: wtss_qgis_dialog_base.ui

# Other ui files for dialogs you create (these will be compiled)
compiled_ui_files:
compiled_ui_files: resources.py

# Resource file(s) that will be compiled
resource_files: resources.qrc
Expand Down

0 comments on commit fd77e56

Please sign in to comment.