diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0713437..b2e9c36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,6 +81,10 @@ jobs: mkdir -p ~/.grdwindinversion echo "'ecmwf_0100_1h': ./test_data/ECMWF/forecast/hourly/0100deg/netcdf_light/%Y/%j/ECMWF_FORECAST_0100_%Y%m%d%H%M_10U_10V.nc" > ~/.grdwindinversion/data_config.yaml echo "'ecmwf_0125_1h': ./test_data/ECMWF/0.125deg/1h/forecasts/%Y/%j/ecmwf_%Y%m%d%H%M.nc" >> ~/.grdwindinversion/data_config.yaml + echo "unit_test_s1_product: './test_data/L1/S1A_IW_GRDH_1SDV_20210909T130650_20210909T130715_039605_04AE83_C34F.SAFE'" >> ~/.grdwindinversion/data_config.yaml + echo "unit_test_rcm_product: './test_data/L1/RCM1_OK2767220_PK2769320_1_SCLND_20230930_214014_VV_VH_GRD'" >> ~/.grdwindinversion/data_config.yaml + echo "unit_test_rs2_product: './test_data/L1/RS2_OK141302_PK1242223_DK1208537_SCWA_20220904_093402_VV_VH_SGF'" >> ~/.grdwindinversion/data_config.yaml + #echo "'nc_luts_path': ./test_data/GMFS/nc_luts" >> ~/.grdwindinversion/data_config.yaml #echo "'lut_cmod7_path': './test_data/GMFS/v1.6/GMF_cmod7_official/cmod7_and_python_script'" >> ~/.grdwindinversion/data_config.yaml #echo "'lut_ms1ahw_path': './test_data/GMFS/v1.6/GMF_cmodms1ahw'" >> ~/.grdwindinversion/data_config.yaml diff --git a/README.md b/README.md index 0017a89..49ef6a7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -# grdwindinversion [![Python Version](https://img.shields.io/pypi/pyversions/grdwindinversion.svg)](https://pypi.org/project/grdwindinversion/) [![Dependencies Status](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)](https://github.com/umr-lops/grdwindinversion/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot) diff --git a/docs/examples/streaks-display.ipynb b/docs/examples/streaks-display.ipynb index e197bba..1707220 100644 --- a/docs/examples/streaks-display.ipynb +++ b/docs/examples/streaks-display.ipynb @@ -14,10 +14,12 @@ "outputs": [], "source": [ "# test on an dummy GRD IW product\n", - "import xsar\n", + "import xsar,os\n", + "import grdwindinversion \n", "filename = xsar.get_test_file('S1A_IW_GRDH_1SDV_20170907T103020_20170907T103045_018268_01EB76_Z010.SAFE')\n", "outdir = \"/tmp/\"\n", - "config_path = \"/home/vincelhx/Documents/autoentreprise/IFREMER/libs/fork_grdwi/grdwindinversion/grdwindinversion/config_prod_streaks.yaml\"\n", + "config_path = os.path.join(os.path.dirname(grdwindinversion.__file__),'config_prod_streaks.yaml')\n", + "assert os.path.exists(config_path)\n", "overwrite = True\n", "resolution = '1000m'" ] @@ -300,7 +302,7 @@ ], "metadata": { "kernelspec": { - "display_name": "env_xsar", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -314,9 +316,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.15" + "version": "3.11.0" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/grdwindinversion/data_config.yaml b/grdwindinversion/data_config.yaml index e840321..f9dd5ca 100644 --- a/grdwindinversion/data_config.yaml +++ b/grdwindinversion/data_config.yaml @@ -1,5 +1,8 @@ -#'ecmwf_0100_1h': '../ecmwf/forecast/hourly/0100deg/netcdf_light_REPRO_tree/%Y/%j/ECMWF_FORECAST_0100_%Y%m%d%H%M_10U_10V.nc' -#'ecmwf_0125_1h': '../ecmwf/0.125deg/1h/forecasts/%Y/%j/ecmwf_%Y%m%d%H%M.nc' +'ecmwf_0100_1h': '../ecmwf/forecast/hourly/0100deg/netcdf_light_REPRO_tree/%Y/%j/ECMWF_FORECAST_0100_%Y%m%d%H%M_10U_10V.nc' +'ecmwf_0125_1h': '../ecmwf/0.125deg/1h/forecasts/%Y/%j/ecmwf_%Y%m%d%H%M.nc' + + +unit_test_s1_product: './sentinel-1a/L1/IW/S1A_IW_GRDH_1S/2021/252/S1A_IW_GRDH_1SDV_20210909T130650_20210909T130715_039605_04AE83_C34F.SAFE' +unit_test_rcm_product: './l1/rcm/rcm-1/sclnd/2023/273/RCM1_OK2767220_PK2769320_1_SCLND_20230930_214014_VV_VH_GRD' +unit_test_rs2_product: './L1/VV_VH/2022/247/RS2_OK141302_PK1242223_DK1208537_SCWA_20220904_093402_VV_VH_SGF' -'ecmwf_0100_1h': '/home/datawork-cersat-public/provider/ecmwf/forecast/hourly/0100deg/netcdf_light_REPRO_tree/%Y/%j/ECMWF_FORECAST_0100_%Y%m%d%H%M_10U_10V.nc' -'ecmwf_0125_1h': '/home/datawork-cersat-intranet/project/ecmwf/0.125deg/1h/forecasts/%Y/%j/ecmwf_%Y%m%d%H%M.nc' \ No newline at end of file diff --git a/grdwindinversion/load_config.py b/grdwindinversion/load_config.py index 861956f..3b1b18f 100644 --- a/grdwindinversion/load_config.py +++ b/grdwindinversion/load_config.py @@ -3,11 +3,14 @@ import os import grdwindinversion from yaml import CLoader as Loader -local_config_potential_path = os.path.expanduser( +local_config_potential_path1 = os.path.expanduser( '~/.grdwindinversion/data_config.yaml') - -if os.path.exists(local_config_potential_path): - config_path = local_config_potential_path +local_config_potential_path2 = os.path.join(os.path.dirname( + grdwindinversion.__file__), 'local_data_config.yaml') +if os.path.exists(local_config_potential_path1): + config_path = local_config_potential_path1 +elif os.path.exists(local_config_potential_path2): + config_path = local_config_potential_path2 else: config_path = os.path.join(os.path.dirname( grdwindinversion.__file__), 'data_config.yaml') diff --git a/pyproject.toml b/pyproject.toml index 65cebb3..b9b12df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,35 @@ [project] name = "grdwindinversion" +description="Package to perform Wind inversion from GRD Level-1 SAR images" +readme = "README.md" +keywords = [ + "xarray", + "earth-observation", + "remote-sensing", + "satellite-imagery", + "Sentinel-1", + "RCM", + "RadarSat2", + "sar", + "synthetic-aperture-radar", +] +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", +] requires-python = ">= 3.9" -description = "Package to perform Wind inversion from GRD Level-1 SAR images" -readme = "README.rst" license = {text = "MIT"} +authors = [ + { name = "Antoine Grouazel", email = "antoine.grouazel@ifremer.fr" }, +] + dependencies = [ "xsar", "xsarsea", @@ -14,21 +40,9 @@ dependencies = [ "scipy", "fsspec", "aiohttp", - "xarray-safe-s1", - "xradarsat2", - "xarray-safe-rcm" ] dynamic = ["version"] -classifiers=[ - 'Development Status :: 2 - Pre-Alpha', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Natural Language :: English', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - ] [build-system] requires = ["setuptools>=64.0", "setuptools-scm"] diff --git a/tests/config_test.yaml b/tests/config_test.yaml index 1515736..30e69c1 100644 --- a/tests/config_test.yaml +++ b/tests/config_test.yaml @@ -46,3 +46,7 @@ RCM: wspd_step: 0.1 phi_step: 1.0 resolution: "high" + +unit_test_s1_product: "./test_data/L1/S1A_IW_GRDH_1SDV_20210909T130650_20210909T130715_039605_04AE83_C34F.SAFE" +unit_test_rcm_product: "./test_data/L1/RCM1_OK2767220_PK2769320_1_SCLND_20230930_214014_VV_VH_GRD" +unit_test_rs2_product: "./test_data/L1/RS2_OK141302_PK1242223_DK1208537_SCWA_20220904_093402_VV_VH_SGF" diff --git a/tests/test_grdwindinversion_ci.py b/tests/test_grdwindinversion_ci.py index 595de9f..857e298 100644 --- a/tests/test_grdwindinversion_ci.py +++ b/tests/test_grdwindinversion_ci.py @@ -2,6 +2,8 @@ import os import urllib.request from grdwindinversion.inversion import makeL2 +import xsar +from grdwindinversion.load_config import getConf # What must be done by the tests: # - Download L1 data @@ -13,12 +15,15 @@ # - For recal : download auxiliary files # - +S1_path = getConf()['unit_test_s1_product'] +rcm_path = getConf()['unit_test_rcm_product'] +rs2_path = getConf()['unit_test_rs2_product'] +print('S1_path',S1_path) def test_makeL2_generation(): l1_files = [ - "./test_data/L1/S1A_IW_GRDH_1SDV_20210909T130650_20210909T130715_039605_04AE83_C34F.SAFE", - "./test_data/L1/RCM1_OK2767220_PK2769320_1_SCLND_20230930_214014_VV_VH_GRD", - "./test_data/L1/RS2_OK141302_PK1242223_DK1208537_SCWA_20220904_093402_VV_VH_SGF" + S1_path, + rcm_path, + rs2_path ] # l1_files = [ @@ -52,3 +57,6 @@ def test_makeL2_generation(): assert ( "owiWindSpeed" in dataset.variables ), "Expected variable 'owiWindSpeed' missing in the dataset" + +if __name__ == '__main__': + test_makeL2_generation()