grdwindinversion 0.2.3.post9__tar.gz → 0.2.3.post11__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. {grdwindinversion-0.2.3.post9/grdwindinversion.egg-info → grdwindinversion-0.2.3.post11}/PKG-INFO +1 -1
  2. grdwindinversion-0.2.3.post11/docs/examples/wind-inversion-from-grd.ipynb +196 -0
  3. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion/inversion.py +211 -123
  4. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11/grdwindinversion.egg-info}/PKG-INFO +1 -1
  5. grdwindinversion-0.2.3.post9/docs/examples/wind-inversion-from-grd.ipynb +0 -134
  6. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/.editorconfig +0 -0
  7. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/.github/dependabot.yml +0 -0
  8. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/.github/workflows/publish.yml +0 -0
  9. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/.gitignore +0 -0
  10. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/.pre-commit-config.yaml +0 -0
  11. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/AUTHORS.rst +0 -0
  12. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/CONTRIBUTING.rst +0 -0
  13. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/HISTORY.rst +0 -0
  14. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/LICENSE +0 -0
  15. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/MANIFEST.in +0 -0
  16. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/Makefile +0 -0
  17. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/README.md +0 -0
  18. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/ci/requirements/docs.yaml +0 -0
  19. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/ci/requirements/environment.yaml +0 -0
  20. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/docs/Makefile +0 -0
  21. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/docs/_static/css/grdwindinversion.css +0 -0
  22. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/docs/algorithm.rst +0 -0
  23. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/docs/authors.rst +0 -0
  24. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/docs/conf.py +0 -0
  25. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/docs/contributing.rst +0 -0
  26. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/docs/history.rst +0 -0
  27. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/docs/index.rst +0 -0
  28. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/docs/installation.rst +0 -0
  29. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/docs/make.bat +0 -0
  30. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/docs/modules.rst +0 -0
  31. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/docs/readme.rst +0 -0
  32. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/docs/usage.rst +0 -0
  33. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion/.github/ISSUE_TEMPLATE.md +0 -0
  34. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion/.gitignore +0 -0
  35. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion/.travis.yml +0 -0
  36. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion/__init__.py +0 -0
  37. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion/config_prod.yaml +0 -0
  38. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion/config_prod_recal.yaml +0 -0
  39. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion/data_config.yaml +0 -0
  40. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion/load_config.py +0 -0
  41. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion/main.py +0 -0
  42. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion/utils.py +0 -0
  43. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion.egg-info/SOURCES.txt +0 -0
  44. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion.egg-info/dependency_links.txt +0 -0
  45. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion.egg-info/entry_points.txt +0 -0
  46. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion.egg-info/requires.txt +0 -0
  47. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/grdwindinversion.egg-info/top_level.txt +0 -0
  48. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/pyproject.toml +0 -0
  49. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/requirements_dev.txt +0 -0
  50. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/requirements_doc.txt +0 -0
  51. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/setup.cfg +0 -0
  52. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/tests/__init__.py +0 -0
  53. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/tests/test_grdwindinversion.py +0 -0
  54. {grdwindinversion-0.2.3.post9 → grdwindinversion-0.2.3.post11}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: grdwindinversion
3
- Version: 0.2.3.post9
3
+ Version: 0.2.3.post11
4
4
  Summary: Package to perform Wind inversion from GRD Level-1 SAR images
5
5
  License: MIT
6
6
  Classifier: Development Status :: 2 - Pre-Alpha
@@ -0,0 +1,196 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "e578297a-d2dc-4cb4-b016-1181649d227b",
6
+ "metadata": {},
7
+ "source": [
8
+ "## Example of Wind inversion"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "fa19ad8e-ebaa-430e-bd91-c21d517e7e88",
14
+ "metadata": {},
15
+ "source": [
16
+ "### define a product GRD Sentinel-1"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "code",
21
+ "execution_count": 5,
22
+ "id": "ef483f15-4690-460b-b688-fa966bab8cd8",
23
+ "metadata": {},
24
+ "outputs": [],
25
+ "source": [
26
+ "import xsar"
27
+ ]
28
+ },
29
+ {
30
+ "cell_type": "code",
31
+ "execution_count": 6,
32
+ "id": "e04fa1b0-eb49-4e45-af0f-0be798e26f95",
33
+ "metadata": {},
34
+ "outputs": [
35
+ {
36
+ "name": "stderr",
37
+ "output_type": "stream",
38
+ "text": [
39
+ "/home/vincelhx/Documents/autoentreprise/IFREMER/libs/fork_xsar_vinc/xsar/src/xsar/xsar.py:212: UserWarning: Downloading https://cyclobs.ifremer.fr/static/sarwing_datarmor/xsardata/S1A_IW_GRDH_1SDV_20170907T103020_20170907T103045_018268_01EB76_Z010.SAFE.zip\n",
40
+ " warnings.warn(\"Downloading %s\" % file_url)\n"
41
+ ]
42
+ },
43
+ {
44
+ "ename": "ClientResponseError",
45
+ "evalue": "503, message='Service Unavailable', url=URL('https://cyclobs.ifremer.fr/static/sarwing_datarmor/xsardata/S1A_IW_GRDH_1SDV_20170907T103020_20170907T103045_018268_01EB76_Z010.SAFE.zip')",
46
+ "output_type": "error",
47
+ "traceback": [
48
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
49
+ "\u001b[0;31mClientResponseError\u001b[0m Traceback (most recent call last)",
50
+ "Cell \u001b[0;32mIn[6], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# test on an dummy GRD IW product\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m input_file \u001b[38;5;241m=\u001b[39m \u001b[43mxsar\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_test_file\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mS1A_IW_GRDH_1SDV_20170907T103020_20170907T103045_018268_01EB76_Z010.SAFE\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n",
51
+ "File \u001b[0;32m~/Documents/autoentreprise/IFREMER/libs/fork_xsar_vinc/xsar/src/xsar/xsar.py:213\u001b[0m, in \u001b[0;36mget_test_file\u001b[0;34m(fname)\u001b[0m\n\u001b[1;32m 211\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mexists(os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mjoin(res_path, fname)):\n\u001b[1;32m 212\u001b[0m warnings\u001b[38;5;241m.\u001b[39mwarn(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mDownloading \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m file_url)\n\u001b[0;32m--> 213\u001b[0m local_file \u001b[38;5;241m=\u001b[39m \u001b[43murl_get\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfile_url\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 214\u001b[0m warnings\u001b[38;5;241m.\u001b[39mwarn(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnzipping \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mjoin(res_path, fname))\n\u001b[1;32m 215\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m zipfile\u001b[38;5;241m.\u001b[39mZipFile(local_file, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mr\u001b[39m\u001b[38;5;124m'\u001b[39m) \u001b[38;5;28;01mas\u001b[39;00m zip_ref:\n",
52
+ "File \u001b[0;32m~/Documents/autoentreprise/IFREMER/libs/fork_xsar_vinc/xsar/src/xsar/utils.py:664\u001b[0m, in \u001b[0;36murl_get\u001b[0;34m(url, cache_dir)\u001b[0m\n\u001b[1;32m 640\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 641\u001b[0m \u001b[38;5;124;03mGet fil from url, using caching.\u001b[39;00m\n\u001b[1;32m 642\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 660\u001b[0m \u001b[38;5;124;03mDue to fsspec, the returned filename won't match the remote one.\u001b[39;00m\n\u001b[1;32m 661\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 663\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m://\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;129;01min\u001b[39;00m url:\n\u001b[0;32m--> 664\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m fsspec\u001b[38;5;241m.\u001b[39mopen(\n\u001b[1;32m 665\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfilecache::\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m'\u001b[39m \u001b[38;5;241m%\u001b[39m url,\n\u001b[1;32m 666\u001b[0m https\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mclient_kwargs\u001b[39m\u001b[38;5;124m'\u001b[39m: {\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtimeout\u001b[39m\u001b[38;5;124m'\u001b[39m: aiohttp\u001b[38;5;241m.\u001b[39mClientTimeout(total\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m3600\u001b[39m)}},\n\u001b[1;32m 667\u001b[0m filecache\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcache_storage\u001b[39m\u001b[38;5;124m'\u001b[39m: os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mjoin(os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mjoin(config[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdata_dir\u001b[39m\u001b[38;5;124m'\u001b[39m], \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfsspec_cache\u001b[39m\u001b[38;5;124m'\u001b[39m))}\n\u001b[1;32m 668\u001b[0m ) \u001b[38;5;28;01mas\u001b[39;00m f:\n\u001b[1;32m 669\u001b[0m fname \u001b[38;5;241m=\u001b[39m f\u001b[38;5;241m.\u001b[39mname\n\u001b[1;32m 670\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
53
+ "File \u001b[0;32m~/.local/lib/python3.10/site-packages/fsspec/core.py:102\u001b[0m, in \u001b[0;36mOpenFile.__enter__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 99\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__enter__\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[1;32m 100\u001b[0m mode \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmode\u001b[38;5;241m.\u001b[39mreplace(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mt\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m)\u001b[38;5;241m.\u001b[39mreplace(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m--> 102\u001b[0m f \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopen\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmode\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 104\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfobjects \u001b[38;5;241m=\u001b[39m [f]\n\u001b[1;32m 106\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcompression \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
54
+ "File \u001b[0;32m~/.local/lib/python3.10/site-packages/fsspec/implementations/cached.py:444\u001b[0m, in \u001b[0;36mCachingFileSystem.__getattribute__.<locals>.<lambda>\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 408\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__getattribute__\u001b[39m(\u001b[38;5;28mself\u001b[39m, item):\n\u001b[1;32m 409\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m item \u001b[38;5;129;01min\u001b[39;00m [\n\u001b[1;32m 410\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mload_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 411\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_open\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 442\u001b[0m \u001b[38;5;66;03m# all the methods defined in this class. Note `open` here, since\u001b[39;00m\n\u001b[1;32m 443\u001b[0m \u001b[38;5;66;03m# it calls `_open`, but is actually in superclass\u001b[39;00m\n\u001b[0;32m--> 444\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mlambda\u001b[39;00m \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkw: \u001b[38;5;28;43mgetattr\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mtype\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mitem\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__get__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 445\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkw\u001b[49m\n\u001b[1;32m 446\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 447\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m item \u001b[38;5;129;01min\u001b[39;00m [\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__reduce_ex__\u001b[39m\u001b[38;5;124m\"\u001b[39m]:\n\u001b[1;32m 448\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mAttributeError\u001b[39;00m\n",
55
+ "File \u001b[0;32m~/.local/lib/python3.10/site-packages/fsspec/spec.py:1151\u001b[0m, in \u001b[0;36mAbstractFileSystem.open\u001b[0;34m(self, path, mode, block_size, cache_options, compression, **kwargs)\u001b[0m\n\u001b[1;32m 1149\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1150\u001b[0m ac \u001b[38;5;241m=\u001b[39m kwargs\u001b[38;5;241m.\u001b[39mpop(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mautocommit\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_intrans)\n\u001b[0;32m-> 1151\u001b[0m f \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_open\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1152\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1153\u001b[0m \u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1154\u001b[0m \u001b[43m \u001b[49m\u001b[43mblock_size\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mblock_size\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1155\u001b[0m \u001b[43m \u001b[49m\u001b[43mautocommit\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mac\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1156\u001b[0m \u001b[43m \u001b[49m\u001b[43mcache_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1157\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1158\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1159\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m compression \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 1160\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mfsspec\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcompression\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m compr\n",
56
+ "File \u001b[0;32m~/.local/lib/python3.10/site-packages/fsspec/implementations/cached.py:444\u001b[0m, in \u001b[0;36mCachingFileSystem.__getattribute__.<locals>.<lambda>\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 408\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__getattribute__\u001b[39m(\u001b[38;5;28mself\u001b[39m, item):\n\u001b[1;32m 409\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m item \u001b[38;5;129;01min\u001b[39;00m [\n\u001b[1;32m 410\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mload_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 411\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_open\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 442\u001b[0m \u001b[38;5;66;03m# all the methods defined in this class. Note `open` here, since\u001b[39;00m\n\u001b[1;32m 443\u001b[0m \u001b[38;5;66;03m# it calls `_open`, but is actually in superclass\u001b[39;00m\n\u001b[0;32m--> 444\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mlambda\u001b[39;00m \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkw: \u001b[38;5;28;43mgetattr\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mtype\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mitem\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__get__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 445\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkw\u001b[49m\n\u001b[1;32m 446\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 447\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m item \u001b[38;5;129;01min\u001b[39;00m [\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__reduce_ex__\u001b[39m\u001b[38;5;124m\"\u001b[39m]:\n\u001b[1;32m 448\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mAttributeError\u001b[39;00m\n",
57
+ "File \u001b[0;32m~/.local/lib/python3.10/site-packages/fsspec/implementations/cached.py:695\u001b[0m, in \u001b[0;36mWholeFileCacheFileSystem._open\u001b[0;34m(self, path, mode, **kwargs)\u001b[0m\n\u001b[1;32m 693\u001b[0m f2\u001b[38;5;241m.\u001b[39mwrite(data)\n\u001b[1;32m 694\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 695\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfn\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 696\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msave_cache()\n\u001b[1;32m 697\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_open(path, mode)\n",
58
+ "File \u001b[0;32m~/.local/lib/python3.10/site-packages/fsspec/asyn.py:115\u001b[0m, in \u001b[0;36msync_wrapper.<locals>.wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 112\u001b[0m \u001b[38;5;129m@functools\u001b[39m\u001b[38;5;241m.\u001b[39mwraps(func)\n\u001b[1;32m 113\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mwrapper\u001b[39m(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 114\u001b[0m \u001b[38;5;28mself\u001b[39m \u001b[38;5;241m=\u001b[39m obj \u001b[38;5;129;01mor\u001b[39;00m args[\u001b[38;5;241m0\u001b[39m]\n\u001b[0;32m--> 115\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43msync\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mloop\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfunc\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
59
+ "File \u001b[0;32m~/.local/lib/python3.10/site-packages/fsspec/asyn.py:100\u001b[0m, in \u001b[0;36msync\u001b[0;34m(loop, func, timeout, *args, **kwargs)\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m FSTimeoutError \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mreturn_result\u001b[39;00m\n\u001b[1;32m 99\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(return_result, \u001b[38;5;167;01mBaseException\u001b[39;00m):\n\u001b[0;32m--> 100\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m return_result\n\u001b[1;32m 101\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 102\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m return_result\n",
60
+ "File \u001b[0;32m~/.local/lib/python3.10/site-packages/fsspec/asyn.py:55\u001b[0m, in \u001b[0;36m_runner\u001b[0;34m(event, coro, result, timeout)\u001b[0m\n\u001b[1;32m 53\u001b[0m coro \u001b[38;5;241m=\u001b[39m asyncio\u001b[38;5;241m.\u001b[39mwait_for(coro, timeout\u001b[38;5;241m=\u001b[39mtimeout)\n\u001b[1;32m 54\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 55\u001b[0m result[\u001b[38;5;241m0\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m coro\n\u001b[1;32m 56\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m ex:\n\u001b[1;32m 57\u001b[0m result[\u001b[38;5;241m0\u001b[39m] \u001b[38;5;241m=\u001b[39m ex\n",
61
+ "File \u001b[0;32m~/.local/lib/python3.10/site-packages/fsspec/asyn.py:562\u001b[0m, in \u001b[0;36mAsyncFileSystem._get\u001b[0;34m(self, rpath, lpath, recursive, callback, **kwargs)\u001b[0m\n\u001b[1;32m 560\u001b[0m callback\u001b[38;5;241m.\u001b[39mbranch(rpath, lpath, kwargs)\n\u001b[1;32m 561\u001b[0m coros\u001b[38;5;241m.\u001b[39mappend(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_get_file(rpath, lpath, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs))\n\u001b[0;32m--> 562\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mawait\u001b[39;00m _run_coros_in_chunks(\n\u001b[1;32m 563\u001b[0m coros, batch_size\u001b[38;5;241m=\u001b[39mbatch_size, callback\u001b[38;5;241m=\u001b[39mcallback\n\u001b[1;32m 564\u001b[0m )\n",
62
+ "File \u001b[0;32m~/.local/lib/python3.10/site-packages/fsspec/asyn.py:246\u001b[0m, in \u001b[0;36m_run_coros_in_chunks\u001b[0;34m(coros, batch_size, callback, timeout, return_exceptions, nofiles)\u001b[0m\n\u001b[1;32m 240\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m callback \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m _DEFAULT_CALLBACK:\n\u001b[1;32m 241\u001b[0m [\n\u001b[1;32m 242\u001b[0m t\u001b[38;5;241m.\u001b[39madd_done_callback(\u001b[38;5;28;01mlambda\u001b[39;00m \u001b[38;5;241m*\u001b[39m_, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39m__: callback\u001b[38;5;241m.\u001b[39mrelative_update(\u001b[38;5;241m1\u001b[39m))\n\u001b[1;32m 243\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m t \u001b[38;5;129;01min\u001b[39;00m chunk\n\u001b[1;32m 244\u001b[0m ]\n\u001b[1;32m 245\u001b[0m results\u001b[38;5;241m.\u001b[39mextend(\n\u001b[0;32m--> 246\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m asyncio\u001b[38;5;241m.\u001b[39mgather(\u001b[38;5;241m*\u001b[39mchunk, return_exceptions\u001b[38;5;241m=\u001b[39mreturn_exceptions),\n\u001b[1;32m 247\u001b[0m )\n\u001b[1;32m 248\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m results\n",
63
+ "File \u001b[0;32m~/miniconda3/envs/xsar_N3_local/lib/python3.10/asyncio/tasks.py:408\u001b[0m, in \u001b[0;36mwait_for\u001b[0;34m(fut, timeout)\u001b[0m\n\u001b[1;32m 405\u001b[0m loop \u001b[38;5;241m=\u001b[39m events\u001b[38;5;241m.\u001b[39mget_running_loop()\n\u001b[1;32m 407\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m timeout \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m--> 408\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mawait\u001b[39;00m fut\n\u001b[1;32m 410\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m timeout \u001b[38;5;241m<\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 411\u001b[0m fut \u001b[38;5;241m=\u001b[39m ensure_future(fut, loop\u001b[38;5;241m=\u001b[39mloop)\n",
64
+ "File \u001b[0;32m~/.local/lib/python3.10/site-packages/fsspec/implementations/http.py:248\u001b[0m, in \u001b[0;36mHTTPFileSystem._get_file\u001b[0;34m(self, rpath, lpath, chunk_size, callback, **kwargs)\u001b[0m\n\u001b[1;32m 245\u001b[0m size \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 247\u001b[0m callback\u001b[38;5;241m.\u001b[39mset_size(size)\n\u001b[0;32m--> 248\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_raise_not_found_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43mr\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrpath\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 249\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m isfilelike(lpath):\n\u001b[1;32m 250\u001b[0m outfile \u001b[38;5;241m=\u001b[39m lpath\n",
65
+ "File \u001b[0;32m~/.local/lib/python3.10/site-packages/fsspec/implementations/http.py:214\u001b[0m, in \u001b[0;36mHTTPFileSystem._raise_not_found_for_status\u001b[0;34m(self, response, url)\u001b[0m\n\u001b[1;32m 212\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m response\u001b[38;5;241m.\u001b[39mstatus \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m404\u001b[39m:\n\u001b[1;32m 213\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m(url)\n\u001b[0;32m--> 214\u001b[0m \u001b[43mresponse\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mraise_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
66
+ "File \u001b[0;32m~/.local/lib/python3.10/site-packages/aiohttp/client_reqrep.py:1005\u001b[0m, in \u001b[0;36mClientResponse.raise_for_status\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1003\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mreason \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 1004\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrelease()\n\u001b[0;32m-> 1005\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ClientResponseError(\n\u001b[1;32m 1006\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrequest_info,\n\u001b[1;32m 1007\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhistory,\n\u001b[1;32m 1008\u001b[0m status\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstatus,\n\u001b[1;32m 1009\u001b[0m message\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mreason,\n\u001b[1;32m 1010\u001b[0m headers\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mheaders,\n\u001b[1;32m 1011\u001b[0m )\n",
67
+ "\u001b[0;31mClientResponseError\u001b[0m: 503, message='Service Unavailable', url=URL('https://cyclobs.ifremer.fr/static/sarwing_datarmor/xsardata/S1A_IW_GRDH_1SDV_20170907T103020_20170907T103045_018268_01EB76_Z010.SAFE.zip')"
68
+ ]
69
+ }
70
+ ],
71
+ "source": [
72
+ "# test on an dummy GRD IW product\n",
73
+ "input_file = xsar.get_test_file('S1A_IW_GRDH_1SDV_20170907T103020_20170907T103045_018268_01EB76_Z010.SAFE')\n"
74
+ ]
75
+ },
76
+ {
77
+ "cell_type": "markdown",
78
+ "id": "f4886386-b19a-4c43-a790-192f4866a692",
79
+ "metadata": {},
80
+ "source": [
81
+ "### perform wind inversion"
82
+ ]
83
+ },
84
+ {
85
+ "cell_type": "code",
86
+ "execution_count": null,
87
+ "id": "d3fda3a2-2ee6-4401-be8f-c0fab8344a49",
88
+ "metadata": {},
89
+ "outputs": [],
90
+ "source": [
91
+ "from grdwindinversion.inversion import makeL2 \n",
92
+ "\n"
93
+ ]
94
+ },
95
+ {
96
+ "cell_type": "markdown",
97
+ "id": "c8924754-34f5-4a27-a598-492022b3b3f5",
98
+ "metadata": {},
99
+ "source": [
100
+ "### define config file"
101
+ ]
102
+ },
103
+ {
104
+ "cell_type": "code",
105
+ "execution_count": null,
106
+ "id": "f95ee426-0b46-4d39-ae90-241e8bbaa332",
107
+ "metadata": {},
108
+ "outputs": [
109
+ {
110
+ "name": "stdout",
111
+ "output_type": "stream",
112
+ "text": [
113
+ "True\n"
114
+ ]
115
+ }
116
+ ],
117
+ "source": [
118
+ "import grdwindinversion\n",
119
+ "import os\n",
120
+ "config_file_s1 = os.path.join(os.path.dirname(grdwindinversion.__file__),'config_prod.yaml')\n",
121
+ "grdwindinversion.__file__\n",
122
+ "print(os.path.exists(config_file_s1))"
123
+ ]
124
+ },
125
+ {
126
+ "cell_type": "code",
127
+ "execution_count": null,
128
+ "id": "3cbe649d-44d7-4a7f-9041-137092a61e07",
129
+ "metadata": {},
130
+ "outputs": [],
131
+ "source": [
132
+ "out_folder = '/tmp/test_windinversion'"
133
+ ]
134
+ },
135
+ {
136
+ "cell_type": "code",
137
+ "execution_count": null,
138
+ "id": "b90c78bb-8643-4d64-a463-28fcb68d9b38",
139
+ "metadata": {},
140
+ "outputs": [
141
+ {
142
+ "ename": "NameError",
143
+ "evalue": "name 'input_file' is not defined",
144
+ "output_type": "error",
145
+ "traceback": [
146
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
147
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
148
+ "Cell \u001b[0;32mIn[4], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m out_file,outds \u001b[38;5;241m=\u001b[39m makeL2(\u001b[43minput_file\u001b[49m,out_folder, config_path\u001b[38;5;241m=\u001b[39mconfig_file_s1,overwrite\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[1;32m 2\u001b[0m outds\n",
149
+ "\u001b[0;31mNameError\u001b[0m: name 'input_file' is not defined"
150
+ ]
151
+ }
152
+ ],
153
+ "source": [
154
+ "out_file,outds = makeL2(input_file,out_folder, config_path=config_file_s1,overwrite=True)\n",
155
+ "outds"
156
+ ]
157
+ },
158
+ {
159
+ "cell_type": "code",
160
+ "execution_count": null,
161
+ "id": "91137cfe",
162
+ "metadata": {},
163
+ "outputs": [],
164
+ "source": []
165
+ },
166
+ {
167
+ "cell_type": "code",
168
+ "execution_count": null,
169
+ "id": "9a83becc",
170
+ "metadata": {},
171
+ "outputs": [],
172
+ "source": []
173
+ }
174
+ ],
175
+ "metadata": {
176
+ "kernelspec": {
177
+ "display_name": "Python 3 (ipykernel)",
178
+ "language": "python",
179
+ "name": "python3"
180
+ },
181
+ "language_info": {
182
+ "codemirror_mode": {
183
+ "name": "ipython",
184
+ "version": 3
185
+ },
186
+ "file_extension": ".py",
187
+ "mimetype": "text/x-python",
188
+ "name": "python",
189
+ "nbconvert_exporter": "python",
190
+ "pygments_lexer": "ipython3",
191
+ "version": "3.10.12"
192
+ }
193
+ },
194
+ "nbformat": 4,
195
+ "nbformat_minor": 5
196
+ }
@@ -219,12 +219,12 @@ def inverse(dual_pol, inc, sigma0, sigma0_dual, ancillary_wind, dsig_cr, model_v
219
219
  Parameters
220
220
  ----------
221
221
  dual_pol: bool
222
- True if dualpol, False if singlepol
222
+ True if dualpol, False if singlepol
223
223
  inc: xarray.DataArray
224
224
  incidence angle
225
225
  sigma0: xarray.DataArray
226
226
  sigma0 to be inverted
227
- sigma0_dual: xarray.DataArray
227
+ sigma0_dual: xarray.DataArray
228
228
  sigma0 to be inverted for dualpol
229
229
  ancillary_wind=: xarray.DataArray (numpy.complex28)
230
230
  ancillary wind
@@ -232,10 +232,10 @@ def inverse(dual_pol, inc, sigma0, sigma0_dual, ancillary_wind, dsig_cr, model_v
232
232
  dsig_cr=: float or xarray.DataArray
233
233
  parameters used for
234
234
 
235
- | `Jsig_cr=((sigma0_gmf - sigma0) / dsig_cr) ** 2`
236
- model_vv=: str
235
+ | `Jsig_cr=((sigma0_gmf - sigma0) / dsig_cr) ** 2`
236
+ model_vv=: str
237
237
  model to use for VV or HH polarization.
238
- model_vh=: str
238
+ model_vh=: str
239
239
  model to use for VH or HV polarization.
240
240
 
241
241
  Returns
@@ -245,8 +245,8 @@ def inverse(dual_pol, inc, sigma0, sigma0_dual, ancillary_wind, dsig_cr, model_v
245
245
 
246
246
  See Also
247
247
  --------
248
- xsarsea documentation
249
- https://cyclobs.ifremer.fr/static/sarwing_datarmor/xsarsea/examples/windspeed_inversion.html
248
+ xsarsea documentation
249
+ https://cyclobs.ifremer.fr/static/sarwing_datarmor/xsarsea/examples/windspeed_inversion.html
250
250
  """
251
251
  logging.debug("inversion")
252
252
 
@@ -306,7 +306,7 @@ def makeL2asOwi(xr_dataset, dual_pol, copol, crosspol, copol_gmf, crosspol_gmf,
306
306
  Returns
307
307
  -------
308
308
  xarray.Dataset
309
- final dataset
309
+ final dataset
310
310
  dict
311
311
  encoding dict
312
312
 
@@ -321,17 +321,33 @@ def makeL2asOwi(xr_dataset, dual_pol, copol, crosspol, copol_gmf, crosspol_gmf,
321
321
  'elevation': 'owiElevationAngle',
322
322
  'ground_heading': 'owiHeading',
323
323
  'land_mask': 'owiLandFlag',
324
- 'offboresight': 'owiOffBoresightAngle',
325
324
  'mask': 'owiMask',
326
325
  'windspeed_co': 'owiWindSpeed_co',
327
- 'windspeed_cross': 'owiWindSpeed_cross',
328
- 'windspeed_dual': 'owiWindSpeed',
329
326
  'winddir_co': 'owiWindDirection_co',
330
- 'winddir_cross': 'owiWindDirection_cross',
331
- 'winddir_dual': 'owiWindDirection',
332
327
  'ancillary_wind_speed': 'owiAncillaryWindSpeed',
333
328
  'ancillary_wind_direction': 'owiAncillaryWindDirection',
334
329
  })
330
+
331
+ if "offboresight" in xr_dataset:
332
+ xr_dataset = xr_dataset.rename(
333
+ {"offboresight": "owiOffboresightAngle"})
334
+
335
+ xr_dataset.owiLon.attrs["units"] = "degrees_east"
336
+ xr_dataset.owiLon.attrs["long_name"] = "Longitude at wind cell center"
337
+ xr_dataset.owiLon.attrs["standard_name"] = "longitude"
338
+
339
+ xr_dataset.owiLat.attrs["units"] = "degrees_north"
340
+ xr_dataset.owiLat.attrs["long_name"] = "Latitude at wind cell center"
341
+ xr_dataset.owiLat.attrs["standard_name"] = "latitude"
342
+
343
+ xr_dataset.owiIncidenceAngle.attrs["units"] = "degrees"
344
+ xr_dataset.owiIncidenceAngle.attrs["long_name"] = "Incidence angle at wind cell center"
345
+ xr_dataset.owiIncidenceAngle.attrs["standard_name"] = "incidence"
346
+
347
+ xr_dataset.owiElevationAngle.attrs["units"] = "degrees"
348
+ xr_dataset.owiElevationAngle.attrs["long_name"] = "Elevation angle at wind cell center"
349
+ xr_dataset.owiElevationAngle.attrs["standard_name"] = "elevation"
350
+
335
351
  xr_dataset['owiNrcs'] = xr_dataset['sigma0_ocean'].sel(pol=copol)
336
352
  xr_dataset.owiNrcs.attrs = xr_dataset.sigma0_ocean.attrs
337
353
  xr_dataset.owiNrcs.attrs['units'] = 'm^2 / m^2'
@@ -341,7 +357,8 @@ def makeL2asOwi(xr_dataset, dual_pol, copol, crosspol, copol_gmf, crosspol_gmf,
341
357
  # NESZ & DSIG
342
358
  xr_dataset = xr_dataset.assign(
343
359
  owiNesz=(['line', 'sample'], xr_dataset.nesz.sel(pol=copol).values))
344
- xr_dataset.owiNesz.attrs = xr_dataset.nesz.attrs
360
+ xr_dataset.owiNesz.attrs['units'] = 'm^2 / m^2'
361
+ xr_dataset.owiNesz.attrs['long_name'] = 'Noise Equivalent SigmaNaught'
345
362
 
346
363
  xr_dataset['owiNrcs_no_noise_correction'] = xr_dataset['sigma0_ocean_raw'].sel(
347
364
  pol=copol)
@@ -358,6 +375,9 @@ def makeL2asOwi(xr_dataset, dual_pol, copol, crosspol, copol_gmf, crosspol_gmf,
358
375
  'swath_number_flag': 'owiSwathNumberFlag'
359
376
  })
360
377
 
378
+ xr_dataset["owiSwathNumber"].attrs["standart_name"] = "swath number"
379
+
380
+ # sigma0_raw__corrected cross
361
381
  if "sigma0_raw__corrected" in xr_dataset:
362
382
  xr_dataset['owiNrcs_no_noise_correction_recalibrated'] = xr_dataset['sigma0_raw__corrected'].sel(
363
383
  pol=copol)
@@ -374,19 +394,25 @@ def makeL2asOwi(xr_dataset, dual_pol, copol, crosspol, copol_gmf, crosspol_gmf,
374
394
 
375
395
  xr_dataset = xr_dataset.rename({
376
396
  'dsig_cross': 'owiDsig_cross',
377
- 'nesz_cross_final': 'owiNesz_cross_final'
397
+ 'nesz_cross_final': 'owiNesz_cross_final',
398
+ 'winddir_cross': 'owiWindDirection_cross',
399
+ 'winddir_dual': 'owiWindDirection',
400
+ 'windspeed_cross': 'owiWindSpeed_cross',
401
+ 'windspeed_dual': 'owiWindSpeed',
378
402
  })
379
-
403
+ # nrcs cross
380
404
  xr_dataset['owiNrcs_cross'] = xr_dataset['sigma0_ocean'].sel(
381
405
  pol=crosspol)
382
406
  xr_dataset.owiNrcs_cross.attrs['units'] = 'm^2 / m^2'
383
407
  xr_dataset.owiNrcs_cross.attrs['long_name'] = 'Normalized Radar Cross Section'
384
408
  xr_dataset.owiNrcs_cross.attrs['definition'] = 'owiNrcs_cross_no_noise_correction - owiNesz_cross'
385
409
 
410
+ # nesz cross
386
411
  xr_dataset = xr_dataset.assign(owiNesz_cross=(
387
412
  ['line', 'sample'], xr_dataset.nesz.sel(pol=crosspol).values)) # no flattening
388
- xr_dataset.owiNesz_cross.attrs = xr_dataset.nesz.attrs
389
- # unused
413
+ xr_dataset.owiNesz_cross.attrs['units'] = 'm^2 / m^2'
414
+ xr_dataset.owiNesz_cross.attrs['long_name'] = 'Noise Equivalent SigmaNaught'
415
+
390
416
  xr_dataset['owiNrcs_cross_no_noise_correction'] = xr_dataset['sigma0_ocean_raw'].sel(
391
417
  pol=crosspol)
392
418
 
@@ -394,6 +420,7 @@ def makeL2asOwi(xr_dataset, dual_pol, copol, crosspol, copol_gmf, crosspol_gmf,
394
420
  xr_dataset.owiNrcs_cross_no_noise_correction.attrs[
395
421
  'long_name'] = 'Normalized Radar Cross Section, no noise correction applied'
396
422
 
423
+ #  sigma0_raw__corrected cross
397
424
  if "sigma0_raw__corrected" in xr_dataset:
398
425
  xr_dataset['owiNrcs_cross_no_noise_correction_recalibrated'] = xr_dataset['sigma0_raw__corrected'].sel(
399
426
  pol=crosspol)
@@ -406,23 +433,7 @@ def makeL2asOwi(xr_dataset, dual_pol, copol, crosspol, copol_gmf, crosspol_gmf,
406
433
 
407
434
  xr_dataset.owiNrcs_cross.attrs['definition'] = 'owiNrcs_cross_no_noise_correction_recalibrated - owiNesz_cross'
408
435
 
409
- xr_dataset["owiWindSpeed_co"].attrs["comment"] = xr_dataset["owiWindSpeed_co"].attrs["comment"].replace(
410
- "wind speed and direction", "wind speed")
411
-
412
- xr_dataset["owiWindDirection_co"].attrs["comment"] = "wind direction in meteorological convention, 0=North, 90=East"
413
-
414
- if dual_pol:
415
- xr_dataset["owiWindSpeed"].attrs["comment"] = xr_dataset["owiWindSpeed"].attrs["comment"].replace(
416
- "wind speed and direction", "wind speed")
417
- xr_dataset["owiWindDirection"].attrs["comment"] = "wind direction in meteorological convention, 0=North, 90=East"
418
-
419
- xr_dataset["owiWindSpeed_cross"].attrs['comment'] = "wind speed inverted from model %s (%s)" % (
420
- crosspol_gmf, crosspol)
421
-
422
- xr_dataset["owiWindDirection_cross"].attrs["comment"] = "wind direction in meteorological convention, 0=North, 90=East, copied from dualpol"
423
-
424
- xr_dataset.owiWindSpeed_cross.attrs['model'] = crosspol_gmf
425
- xr_dataset.owiWindSpeed_cross.attrs['units'] = 'm/s'
436
+ #  other variables
426
437
 
427
438
  xr_dataset['owiWindQuality'] = xr.full_like(xr_dataset.owiNrcs, 0)
428
439
  xr_dataset['owiWindQuality'].attrs[
@@ -431,7 +442,7 @@ def makeL2asOwi(xr_dataset, dual_pol, copol, crosspol, copol_gmf, crosspol_gmf,
431
442
  xr_dataset['owiWindQuality'].attrs['flag_values'] = np.array([
432
443
  0, 1, 2, 3])
433
444
  xr_dataset['owiWindQuality'].attrs['flag_meanings'] = "good medium low poor"
434
- xr_dataset['owiWindQuality'].attrs['comment'] = 'not done yet'
445
+ xr_dataset['owiWindQuality'].attrs['comment'] = 'NOT COMPUTED YET'
435
446
 
436
447
  xr_dataset['owiWindFilter'] = xr.full_like(xr_dataset.owiNrcs, 0)
437
448
  xr_dataset['owiWindFilter'].attrs['long_name'] = "Quality flag taking into account the local heterogeneity"
@@ -440,7 +451,7 @@ def makeL2asOwi(xr_dataset, dual_pol, copol, crosspol, copol_gmf, crosspol_gmf,
440
451
  0, 1, 2, 3])
441
452
  xr_dataset['owiWindFilter'].attrs[
442
453
  'flag_meanings'] = "homogeneous_NRCS, heterogeneous_from_co-polarization_NRCS, heterogeneous_from_cross-polarization_NRCS, heterogeneous_from_dual-polarization_NRCS"
443
- xr_dataset['owiWindFilter'].attrs['comment'] = 'not done yet'
454
+ xr_dataset['owiWindFilter'].attrs['comment'] = 'NOT COMPUTED YET'
444
455
 
445
456
  xr_dataset = xr_dataset.rename(
446
457
  {"line": "owiAzSize", "sample": "owiRaSize"})
@@ -455,50 +466,6 @@ def makeL2asOwi(xr_dataset, dual_pol, copol, crosspol, copol_gmf, crosspol_gmf,
455
466
 
456
467
  xr_dataset.compute()
457
468
 
458
- for var in ['footprint', 'multidataset', 'rawDataStartTime', 'specialHandlingRequired']:
459
- if var in xr_dataset.attrs:
460
- xr_dataset.attrs[var] = str(xr_dataset.attrs[var])
461
- if "approx_transform" in xr_dataset.attrs:
462
- del xr_dataset.attrs["approx_transform"]
463
-
464
- xr_dataset.attrs["TITLE"] = "Sentinel-1 OWI Component"
465
- xr_dataset.attrs["missionPhase"] = "Test"
466
- xr_dataset.attrs["acquisitionStation"] = "/"
467
- xr_dataset.attrs["softwareVersion"] = "/"
468
- xr_dataset.attrs["pythonVersion"] = str(
469
- sys.version_info.major)+'.'+str(sys.version_info.minor)
470
- xr_dataset.attrs["polarisationRatio"] = "/"
471
- xr_dataset.attrs["l2ProcessingUtcTime"] = datetime.datetime.now().strftime(
472
- "%Y-%m-%dT%H:%M:%SZ")
473
- xr_dataset.attrs["processingCenter"] = "/"
474
- try:
475
- xr_dataset.attrs["firstMeasurementTime"] = datetime.datetime.strptime(xr_dataset.attrs['start_date'],
476
- "%Y-%m-%d %H:%M:%S.%f").strftime(
477
- "%Y-%m-%dT%H:%M:%SZ")
478
- xr_dataset.attrs["lastMeasurementTime"] = datetime.datetime.strptime(xr_dataset.attrs['stop_date'],
479
- "%Y-%m-%d %H:%M:%S.%f").strftime(
480
- "%Y-%m-%dT%H:%M:%SZ")
481
- except:
482
- xr_dataset.attrs["firstMeasurementTime"] = datetime.datetime.strptime(xr_dataset.attrs['start_date'],
483
- "%Y-%m-%d %H:%M:%S").strftime(
484
- "%Y-%m-%dT%H:%M:%SZ")
485
- xr_dataset.attrs["lastMeasurementTime"] = datetime.datetime.strptime(xr_dataset.attrs['stop_date'],
486
- "%Y-%m-%d %H:%M:%S").strftime(
487
- "%Y-%m-%dT%H:%M:%SZ")
488
- xr_dataset.attrs["clmSource"] = "/"
489
- xr_dataset.attrs["bathySource"] = "/"
490
- xr_dataset.attrs['oswAlgorithmName'] = 'grdwindinversion'
491
- xr_dataset.attrs["owiAlgorithmVersion"] = grdwindinversion.__version__
492
- xr_dataset.attrs["gmf"] = config['GMF_'+copol_gmf+'_NAME'] + \
493
- ", " + config["GMF_"+crosspol_gmf+"_NAME"]
494
- xr_dataset.attrs["iceSource"] = "/"
495
- xr_dataset.attrs["owiNoiseCorrection"] = "False"
496
- xr_dataset.attrs["inversionTabGMF"] = config['GMF_'+copol_gmf +
497
- '_NAME'] + ", " + config["GMF_"+crosspol_gmf+"_NAME"]
498
- xr_dataset.attrs["wnf_3km_average"] = "/"
499
- xr_dataset.attrs["owiWindSpeedSrc"] = "owiWindSpeed"
500
- xr_dataset.attrs["owiWindDirectionSrc"] = "/"
501
-
502
469
  table_fillValue = {
503
470
  "owiWindQuality": -1,
504
471
  "owiHeading": 9999.99,
@@ -523,9 +490,6 @@ def makeL2asOwi(xr_dataset, dual_pol, copol, crosspol, copol_gmf, crosspol_gmf,
523
490
  else:
524
491
  encoding[var].update({'_FillValue': None})
525
492
 
526
- xr_dataset.attrs["xsar_version"] = xsar.__version__
527
- xr_dataset.attrs["xsarsea_version"] = xsarsea.__version__
528
-
529
493
  return xr_dataset, encoding
530
494
 
531
495
 
@@ -611,21 +575,7 @@ def makeL2(filename, out_folder, config_path, overwrite=False, generateCSV=True,
611
575
  xr_dataset = xsar_dataset.datatree['measurement'].to_dataset()
612
576
 
613
577
  xr_dataset = xr_dataset.rename(map_model)
614
- # add attributes
615
578
  xr_dataset.attrs = xsar_dataset.dataset.attrs
616
- xr_dataset.attrs['L1_path'] = xr_dataset.attrs.pop('name')
617
- xr_dataset.attrs["sourceProduct"] = sensor
618
- xr_dataset.attrs["missionName"] = sensor_longname
619
- if ((recalibration) & ("SENTINEL" in sensor_longname)):
620
- xr_dataset.attrs["path_aux_pp1_new"] = os.path.basename(os.path.dirname(
621
- os.path.dirname(xsar_dataset.datatree['recalibration'].attrs['path_aux_pp1_new'])))
622
- xr_dataset.attrs["path_aux_cal_new"] = os.path.basename(os.path.dirname(
623
- os.path.dirname(xsar_dataset.datatree['recalibration'].attrs['path_aux_cal_new'])))
624
-
625
- xr_dataset.attrs["path_aux_pp1_old"] = os.path.basename(os.path.dirname(
626
- os.path.dirname(xsar_dataset.datatree['recalibration'].attrs['path_aux_pp1_old'])))
627
- xr_dataset.attrs["path_aux_cal_old"] = os.path.basename(os.path.dirname(
628
- os.path.dirname(xsar_dataset.datatree['recalibration'].attrs['path_aux_cal_old'])))
629
579
 
630
580
  except Exception as e:
631
581
  logging.info('%s', traceback.format_exc())
@@ -663,8 +613,33 @@ def makeL2(filename, out_folder, config_path, overwrite=False, generateCSV=True,
663
613
  variables = list(set(xr_dataset) - set(black_list))
664
614
  xr_dataset = xr_dataset[variables]
665
615
 
666
- # TODO Better land mask
667
- # xr_dataset.land_mask.values = cv2.dilate(xr_dataset['land_mask'].values.astype('uint8'),np.ones((3,3),np.uint8),iterations = 3)
616
+ #  lon/lat
617
+ xr_dataset.longitude.attrs["units"] = "degrees_east"
618
+ xr_dataset.longitude.attrs["long_name"] = "Longitude at wind cell center"
619
+ xr_dataset.longitude.attrs["standard_name"] = "longitude"
620
+
621
+ xr_dataset.latitude.attrs["units"] = "degrees_north"
622
+ xr_dataset.latitude.attrs["long_name"] = "Latitude at wind cell center"
623
+ xr_dataset.latitude.attrs["standard_name"] = "latitude"
624
+
625
+ #  incidence
626
+ xr_dataset.incidence.attrs["units"] = "degrees"
627
+ xr_dataset.incidence.attrs["long_name"] = "Incidence angle at wind cell center"
628
+ xr_dataset.incidence.attrs["standard_name"] = "incidence"
629
+
630
+ #  elevation
631
+ xr_dataset.elevation.attrs["units"] = "degrees"
632
+ xr_dataset.elevation.attrs["long_name"] = "Elevation angle at wind cell center"
633
+ xr_dataset.elevation.attrs["standard_name"] = "elevation"
634
+
635
+ # offboresight
636
+ # TOREMOVE
637
+ if "offboresight" in xr_dataset:
638
+ xr_dataset.offboresight.attrs["units"] = "degrees"
639
+ xr_dataset.offboresight.attrs["long_name"] = "Offboresight angle at wind cell center"
640
+ xr_dataset.elevation.attrs["standard_name"] = "offboresight"
641
+
642
+ # masks (no ice / no_valid)
668
643
  xr_dataset.land_mask.values = binary_dilation(xr_dataset['land_mask'].values.astype('uint8'),
669
644
  structure=np.ones((3, 3), np.uint8), iterations=3)
670
645
  xr_dataset.land_mask.attrs['long_name'] = 'Mask of data'
@@ -672,8 +647,6 @@ def makeL2(filename, out_folder, config_path, overwrite=False, generateCSV=True,
672
647
  xr_dataset.land_mask.attrs['flag_values'] = np.array([0, 1])
673
648
  xr_dataset.land_mask.attrs['flag_meanings'] = 'valid no_valid'
674
649
 
675
- # MASK
676
- # Careful : in sarwing process sometimes there are 2 & 3. Not made here
677
650
  logging.debug("mask is a copy of land_mask")
678
651
 
679
652
  xr_dataset['mask'] = xr.DataArray(xr_dataset.land_mask)
@@ -683,7 +656,7 @@ def makeL2(filename, out_folder, config_path, overwrite=False, generateCSV=True,
683
656
  xr_dataset.mask.attrs['flag_values'] = np.array([0, 1, 2, 3])
684
657
  xr_dataset.mask.attrs['flag_meanings'] = 'valid land ice no_valid'
685
658
 
686
- # ANCILLARY
659
+ # ancillary
687
660
  xr_dataset['ancillary_wind_direction'] = (
688
661
  90. - np.rad2deg(np.arctan2(xr_dataset.model_V10, xr_dataset.model_U10)) + 180) % 360
689
662
 
@@ -715,13 +688,15 @@ def makeL2(filename, out_folder, config_path, overwrite=False, generateCSV=True,
715
688
  1].strip()
716
689
  xr_dataset = xr_dataset.drop_vars(['model_U10', 'model_V10'])
717
690
 
718
- # NRCS & NESZ
691
+ # nrcs processing
719
692
  xr_dataset['sigma0_ocean'] = xr.where(xr_dataset['mask'], np.nan,
720
693
  xr_dataset['sigma0'].compute()).transpose(*xr_dataset['sigma0'].dims)
721
694
  xr_dataset['sigma0_ocean'] = xr.where(
722
695
  xr_dataset['sigma0_ocean'] <= 0, np.nan, xr_dataset['sigma0_ocean'])
723
696
 
724
697
  xr_dataset['sigma0_ocean'].attrs = xr_dataset['sigma0'].attrs
698
+ #  we forced it to nan
699
+ xr_dataset['sigma0_ocean'].attrs['comment'] = "clipped, no values <=0"
725
700
 
726
701
  xr_dataset['sigma0_ocean_raw'] = xr.where(xr_dataset['mask'], np.nan,
727
702
  xr_dataset['sigma0_raw'].compute()).transpose(*xr_dataset['sigma0_raw'].dims)
@@ -729,21 +704,24 @@ def makeL2(filename, out_folder, config_path, overwrite=False, generateCSV=True,
729
704
  xr_dataset['sigma0_ocean_raw'] <= 0, np.nan, xr_dataset['sigma0_ocean_raw'])
730
705
  xr_dataset['sigma0_ocean_raw'].attrs = xr_dataset['sigma0_raw'].attrs
731
706
 
707
+ # processing
732
708
  if dual_pol:
733
-
734
709
  if config["apply_flattening"]:
735
710
  xr_dataset = xr_dataset.assign(nesz_cross_final=(
736
711
  ['line', 'sample'], windspeed.nesz_flattening(xr_dataset.nesz.sel(pol=crosspol), xr_dataset.incidence)))
737
712
  xr_dataset['nesz_cross_final'].attrs[
738
713
  "comment"] = 'nesz has been flattened using windspeed.nesz_flattening'
714
+
739
715
  else:
740
716
  xr_dataset = xr_dataset.assign(
741
717
  nesz_cross_final=(['line', 'sample'], xr_dataset.nesz.sel(pol=crosspol).values))
742
718
  xr_dataset['nesz_cross_final'].attrs["comment"] = 'nesz has not been flattened'
743
- # dsig
744
719
 
745
- sigma0_ocean_cross = xr_dataset['sigma0_ocean'].sel(pol=crosspol)
720
+ xr_dataset.nesz_cross_final.attrs['units'] = 'm^2 / m^2'
721
+ xr_dataset.nesz_cross_final.attrs['long_name'] = 'Noise Equivalent SigmaNaught'
746
722
 
723
+ # dsig
724
+ sigma0_ocean_cross = xr_dataset['sigma0_ocean'].sel(pol=crosspol)
747
725
  xr_dataset["dsig_cross"] = windspeed.get_dsig(config["dsig_"+crosspol_gmf+"_NAME"], xr_dataset.incidence,
748
726
  sigma0_ocean_cross, xr_dataset.nesz_cross_final)
749
727
 
@@ -753,38 +731,148 @@ def makeL2(filename, out_folder, config_path, overwrite=False, generateCSV=True,
753
731
  sigma0_ocean_cross = None
754
732
  dsig_cross = 0.1 # default value set in xsarsea
755
733
 
734
+ model_vv = config["GMF_"+copol_gmf+"_NAME"]
735
+ model_vh = config["GMF_"+crosspol_gmf+"_NAME"]
736
+
756
737
  wind_co, wind_dual, windspeed_cr = inverse(dual_pol,
757
- inc=xr_dataset.incidence,
738
+ inc=xr_dataset['incidence'],
758
739
  sigma0=xr_dataset['sigma0_ocean'].sel(
759
740
  pol=copol),
760
741
  sigma0_dual=sigma0_ocean_cross,
761
742
  ancillary_wind=xr_dataset['ancillary_wind'],
762
743
  dsig_cr=dsig_cross,
763
- model_vv=config["GMF_" +
764
- copol_gmf+"_NAME"],
765
- model_vh=config["GMF_"+crosspol_gmf+"_NAME"])
744
+ model_vv=model_vv,
745
+ model_vh=model_vh)
766
746
 
767
- #  get windspeeds
747
+ # windspeed_co
768
748
  xr_dataset['windspeed_co'] = np.abs(wind_co)
769
- xr_dataset['windspeed_dual'] = np.abs(wind_dual)
749
+ xr_dataset["windspeed_co"].attrs["units"] = "m.s⁻1"
750
+ xr_dataset["windspeed_co"].attrs["long_name"] = "Wind speed inverted from model %s (%s)" % (
751
+ model_vv, copol)
752
+ xr_dataset["windspeed_co"].attrs["standart_name"] = "wind_speed"
753
+ xr_dataset["windspeed_co"].attrs["model"] = wind_co.attrs["model"]
754
+ del xr_dataset["windspeed_co"].attrs['comment']
755
+
756
+ # winddir_co
757
+ xr_dataset['winddir_co'] = (
758
+ 90 - (np.angle(-np.conj(wind_co), deg=True)) + xr_dataset.ground_heading) % 360
759
+ xr_dataset["winddir_co"].attrs["units"] = "degrees_north"
760
+ xr_dataset["winddir_co"].attrs["long_name"] = "Wind direction in meteorological convention, 0=North, 90=East, inverted from model %s (%s)" % (
761
+ model_vv, copol)
762
+ xr_dataset["winddir_co"].attrs["standart_name"] = "wind_direction"
763
+ xr_dataset["winddir_co"].attrs["model"] = wind_co.attrs["model"]
770
764
 
765
+ # windspeed_dual / windspeed_cr / /winddir_dual / winddir_cr
771
766
  if dual_pol:
767
+ xr_dataset['windspeed_dual'] = np.abs(wind_dual)
768
+ xr_dataset["windspeed_dual"].attrs["units"] = "m.s⁻1"
769
+ xr_dataset["windspeed_dual"].attrs["long_name"] = "Wind speed inverted from model %s (%s) & %s (%s)" % (
770
+ model_vv, copol, model_vh, crosspol)
771
+ xr_dataset["windspeed_dual"].attrs["standart_name"] = "wind_speed"
772
+ xr_dataset["windspeed_dual"].attrs["model"] = wind_dual.attrs["model"]
773
+ del xr_dataset["windspeed_dual"].attrs['comment']
774
+
775
+ xr_dataset['winddir_dual'] = (
776
+ 90 - (np.angle(-np.conj(wind_dual), deg=True)) + xr_dataset.ground_heading) % 360
777
+ xr_dataset["winddir_dual"].attrs["units"] = "degrees_north"
778
+ xr_dataset["winddir_dual"].attrs["long_name"] = "Wind direction in meteorological convention, 0=North, 90=East inverted from model %s (%s) & %s (%s)" % (
779
+ model_vv, copol, model_vh, crosspol)
780
+ xr_dataset["winddir_dual"].attrs["standart_name"] = "wind_direction"
781
+ xr_dataset["winddir_dual"].attrs["model"] = wind_dual.attrs["model"]
782
+
772
783
  xr_dataset = xr_dataset.assign(
773
784
  windspeed_cross=(['line', 'sample'], windspeed_cr))
774
- else:
775
- xr_dataset['windspeed_cross'] = windspeed_cr
776
-
777
- #  get winddirections
778
- xr_dataset['winddir_co'] = (
779
- 90 - (np.angle(-np.conj(wind_co), deg=True)) + xr_dataset.ground_heading) % 360
780
-
781
- xr_dataset['winddir_dual'] = (
782
- 90 - (np.angle(-np.conj(wind_dual), deg=True)) + xr_dataset.ground_heading) % 360
783
- xr_dataset['winddir_cross'] = xr_dataset['winddir_dual'].copy()
785
+ xr_dataset["windspeed_cross"].attrs["units"] = "m.s⁻1"
786
+ xr_dataset["windspeed_cross"].attrs["long_name"] = "Wind Speed inverted from model %s (%s)" % (
787
+ model_vh, crosspol)
788
+ xr_dataset["windspeed_cross"].attrs["standart_name"] = "wind_speed"
789
+ xr_dataset["windspeed_cross"].attrs["model"] = "%s" % (model_vh)
790
+
791
+ xr_dataset['winddir_cross'] = xr_dataset['winddir_dual'].copy()
792
+ xr_dataset["winddir_cross"].attrs["units"] = "degrees_north"
793
+ xr_dataset["winddir_cross"].attrs["long_name"] = "Wind direction in meteorological convention, 0=North, 90=East, copied from dualpol"
794
+ xr_dataset["winddir_cross"].attrs["standart_name"] = "wind_direction"
795
+ xr_dataset["winddir_cross"].attrs["model"] = "No model used ; content is a copy of dualpol wind direction"
784
796
 
785
797
  xr_dataset, encoding = makeL2asOwi(
786
798
  xr_dataset, dual_pol, copol, crosspol, copol_gmf, crosspol_gmf, config)
787
799
 
800
+ #  add attributes
801
+ firstMeasurementTime = None
802
+ lastMeasurementTime = None
803
+ try:
804
+ firstMeasurementTime = datetime.datetime.strptime(xr_dataset.attrs['start_date'],
805
+ "%Y-%m-%d %H:%M:%S.%f").strftime(
806
+ "%Y-%m-%dT%H:%M:%SZ")
807
+ lastMeasurementTime = datetime.datetime.strptime(xr_dataset.attrs['stop_date'],
808
+ "%Y-%m-%d %H:%M:%S.%f").strftime(
809
+ "%Y-%m-%dT%H:%M:%SZ")
810
+ except:
811
+ firstMeasurementTime = datetime.datetime.strptime(xr_dataset.attrs['start_date'],
812
+ "%Y-%m-%d %H:%M:%S").strftime(
813
+ "%Y-%m-%dT%H:%M:%SZ")
814
+ lastMeasurementTime = datetime.datetime.strptime(xr_dataset.attrs['stop_date'],
815
+ "%Y-%m-%d %H:%M:%S").strftime(
816
+ "%Y-%m-%dT%H:%M:%SZ")
817
+
818
+ attrs = {
819
+ "TITLE": "Sentinel-1 OWI Component",
820
+ "productOwner": "IFREMER",
821
+ "sourceProduct": (xr_dataset.attrs["safe"] if "safe" in xr_dataset.attrs else os.path.basename(xr_dataset.attrs["product_path"])),
822
+ "sourceProduct_fullpath": xr_dataset.attrs.pop('name'),
823
+ "missionName": sensor_longname,
824
+ "missionPhase": "Operational",
825
+ "polarisation": xr_dataset.attrs['pols'],
826
+ "acquisitionStation": '',
827
+ "xsar_version": xsar.__version__,
828
+ "xsarsea_version": xsarsea.__version__,
829
+ "pythonVersion": f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
830
+ "polarisationRatio": "/",
831
+ "l2ProcessingUtcTime": datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ"),
832
+ "processingCenter": "IFREMER",
833
+ "firstMeasurementTime": firstMeasurementTime,
834
+ "lastMeasurementTime": lastMeasurementTime,
835
+ "clmSource": "/",
836
+ "bathySource": "/",
837
+ "oswAlgorithmName": "grdwindinversion",
838
+ "owiAlgorithmVersion": grdwindinversion.__version__,
839
+ "gmf": config['GMF_'+copol_gmf+'_NAME'] + ", " + config["GMF_"+crosspol_gmf+"_NAME"],
840
+ "iceSource": "/",
841
+ "owiNoiseCorrection": "True",
842
+ "inversionTabGMF": config['GMF_'+copol_gmf +
843
+ '_NAME'] + ", " + config["GMF_"+crosspol_gmf+"_NAME"],
844
+ "wnf_3km_average": "False",
845
+ "owiWindSpeedSrc": "owiWindSpeed",
846
+ "owiWindDirectionSrc": "/",
847
+ "ancillary_source": xr_dataset.attrs['ancillary_source']
848
+ }
849
+
850
+ if ((recalibration) & ("SENTINEL" in sensor_longname)):
851
+ attrs["path_aux_pp1_new"] = os.path.basename(os.path.dirname(
852
+ os.path.dirname(xsar_dataset.datatree['recalibration'].attrs['path_aux_pp1_new'])))
853
+ attrs["path_aux_cal_new"] = os.path.basename(os.path.dirname(
854
+ os.path.dirname(xsar_dataset.datatree['recalibration'].attrs['path_aux_cal_new'])))
855
+
856
+ attrs["path_aux_pp1_old"] = os.path.basename(os.path.dirname(
857
+ os.path.dirname(xsar_dataset.datatree['recalibration'].attrs['path_aux_pp1_old'])))
858
+ attrs["path_aux_cal_old"] = os.path.basename(os.path.dirname(
859
+ os.path.dirname(xsar_dataset.datatree['recalibration'].attrs['path_aux_cal_old'])))
860
+
861
+ # new one to match convention
862
+ _S1_added_attrs = ["product", "ipf", "multi_dataset", "footprint",
863
+ "coverage", "orbit_pass", "platform_heading"]
864
+ _RS2_added_attrs = ["passDirection", "swath", "footprint", "coverage"]
865
+ _RCM_added_attrs = ["swath", "footprint", "coverage", "productId",]
866
+
867
+ for sup_attr in _S1_added_attrs + _RS2_added_attrs + _RCM_added_attrs:
868
+ if sup_attr in xr_dataset.attrs:
869
+ attrs[sup_attr] = xr_dataset.attrs[sup_attr]
870
+ for var in ['footprint', 'multidataset']:
871
+ if var in attrs:
872
+ attrs[var] = str(attrs[var])
873
+
874
+ xr_dataset.attrs = attrs
875
+
788
876
  os.makedirs(os.path.dirname(out_file), exist_ok=True)
789
877
 
790
878
  xr_dataset.to_netcdf(out_file, mode="w", encoding=encoding)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: grdwindinversion
3
- Version: 0.2.3.post9
3
+ Version: 0.2.3.post11
4
4
  Summary: Package to perform Wind inversion from GRD Level-1 SAR images
5
5
  License: MIT
6
6
  Classifier: Development Status :: 2 - Pre-Alpha
@@ -1,134 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "markdown",
5
- "id": "e578297a-d2dc-4cb4-b016-1181649d227b",
6
- "metadata": {},
7
- "source": [
8
- "## Example of Wind inversion"
9
- ]
10
- },
11
- {
12
- "cell_type": "markdown",
13
- "id": "fa19ad8e-ebaa-430e-bd91-c21d517e7e88",
14
- "metadata": {},
15
- "source": [
16
- "### define a product GRD Sentinel-1"
17
- ]
18
- },
19
- {
20
- "cell_type": "code",
21
- "execution_count": null,
22
- "id": "ef483f15-4690-460b-b688-fa966bab8cd8",
23
- "metadata": {},
24
- "outputs": [],
25
- "source": [
26
- "import xsar"
27
- ]
28
- },
29
- {
30
- "cell_type": "code",
31
- "execution_count": null,
32
- "id": "e04fa1b0-eb49-4e45-af0f-0be798e26f95",
33
- "metadata": {},
34
- "outputs": [],
35
- "source": [
36
- "# test on an dummy GRD IW product\n",
37
- "input_file = xsar.get_test_file('S1A_IW_GRDH_1SDV_20170907T103020_20170907T103045_018268_01EB76_Z010.SAFE')\n"
38
- ]
39
- },
40
- {
41
- "cell_type": "markdown",
42
- "id": "f4886386-b19a-4c43-a790-192f4866a692",
43
- "metadata": {},
44
- "source": [
45
- "### perform wind inversion"
46
- ]
47
- },
48
- {
49
- "cell_type": "code",
50
- "execution_count": null,
51
- "id": "d3fda3a2-2ee6-4401-be8f-c0fab8344a49",
52
- "metadata": {},
53
- "outputs": [],
54
- "source": [
55
- "from grdwindinversion.inversion import makeL2 \n",
56
- "\n"
57
- ]
58
- },
59
- {
60
- "cell_type": "markdown",
61
- "id": "c8924754-34f5-4a27-a598-492022b3b3f5",
62
- "metadata": {},
63
- "source": [
64
- "### define config file"
65
- ]
66
- },
67
- {
68
- "cell_type": "code",
69
- "execution_count": null,
70
- "id": "f95ee426-0b46-4d39-ae90-241e8bbaa332",
71
- "metadata": {},
72
- "outputs": [],
73
- "source": [
74
- "import grdwindinversion\n",
75
- "import os\n",
76
- "config_file_s1 = os.path.join(os.path.dirname(grdwindinversion.__file__),'config_S1.yaml')\n",
77
- "grdwindinversion.__file__\n",
78
- "print(os.path.exists(config_file_s1))"
79
- ]
80
- },
81
- {
82
- "cell_type": "code",
83
- "execution_count": null,
84
- "id": "3cbe649d-44d7-4a7f-9041-137092a61e07",
85
- "metadata": {},
86
- "outputs": [],
87
- "source": [
88
- "out_folder = '/tmp/test_windinversion'"
89
- ]
90
- },
91
- {
92
- "cell_type": "code",
93
- "execution_count": null,
94
- "id": "27bc671b-d78c-4d70-b898-eac4093253e0",
95
- "metadata": {},
96
- "outputs": [],
97
- "source": [
98
- "makeL2?"
99
- ]
100
- },
101
- {
102
- "cell_type": "code",
103
- "execution_count": null,
104
- "id": "b90c78bb-8643-4d64-a463-28fcb68d9b38",
105
- "metadata": {},
106
- "outputs": [],
107
- "source": [
108
- "out_file,outds = makeL2(input_file,out_folder, config_path=config_file_s1,overwrite=True)\n",
109
- "outds"
110
- ]
111
- }
112
- ],
113
- "metadata": {
114
- "kernelspec": {
115
- "display_name": "Python 3 (ipykernel)",
116
- "language": "python",
117
- "name": "python3"
118
- },
119
- "language_info": {
120
- "codemirror_mode": {
121
- "name": "ipython",
122
- "version": 3
123
- },
124
- "file_extension": ".py",
125
- "mimetype": "text/x-python",
126
- "name": "python",
127
- "nbconvert_exporter": "python",
128
- "pygments_lexer": "ipython3",
129
- "version": "3.9.15"
130
- }
131
- },
132
- "nbformat": 4,
133
- "nbformat_minor": 5
134
- }