grdwindinversion 0.2.4__py3-none-any.whl → 0.2.5__py3-none-any.whl

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.
@@ -98,10 +98,10 @@ def getOutputName2(input_file, outdir, sensor, meta, subdir=True):
98
98
  regex = re.compile(
99
99
  "([A-Z0-9]+)_OK([0-9]+)_PK([0-9]+)_(.*?)_(.*?)_(.*?)_(.*?)_(.*?)_(.*?)_(.*?)")
100
100
  template = string.Template(
101
- "${MISSIONID}_OK${DATA1}_PK${DATA2}_${DATA3}_${BEAM_MODE}_${DATE}_${TIME}_${POLARIZATION1}_${POLARIZATION2}_${PRODUCT}")
101
+ "${MISSIONID}_OK${DATA1}_PK${DATA2}_${DATA3}_${BEAM}_${DATE}_${TIME}_${POLARIZATION1}_${POLARIZATION2}_${PRODUCT}")
102
102
  match = regex.match(basename_match)
103
103
  MISSIONID, DATA1, DATA2, DATA3, BEAM_MODE, DATE, TIME, POLARIZATION1, POLARIZATION2, LAST = match.groups()
104
- new_format = f"{MISSIONID.lower()}-{BEAM_MODE.lower()}-owi-xx-{meta_start_date.lower()}-{meta_stop_date.lower()}-_____-_____.nc"
104
+ new_format = f"{MISSIONID.lower()}-{BEAM.lower()}-owi-xx-{meta_start_date.lower()}-{meta_stop_date.lower()}-_____-_____.nc"
105
105
  else:
106
106
  raise ValueError(
107
107
  "sensor must be S1A|S1B|RS2|RCM, got sensor %s" % sensor)
@@ -243,7 +243,7 @@ def inverse(dual_pol, inc, sigma0, sigma0_dual, ancillary_wind, dsig_cr, model_c
243
243
  See Also
244
244
  --------
245
245
  xsarsea documentation
246
- https://cyclobs.ifremer.fr/static/sarwing_datarmor/xsarsea/examples/windspeed_inversion.html
246
+ https://cerweb.ifremer.fr/datarmor/doc_sphinx/xsarsea/
247
247
  """
248
248
  logging.debug("inversion")
249
249
 
@@ -282,7 +282,7 @@ def inverse(dual_pol, inc, sigma0, sigma0_dual, ancillary_wind, dsig_cr, model_c
282
282
  return wind_co, None, None
283
283
 
284
284
 
285
- def makeL2asOwi(xr_dataset, dual_pol, copol, crosspol, add_streaks):
285
+ def makeL2asOwi(xr_dataset, dual_pol, copol, crosspol, add_streaks, apply_flattening):
286
286
  """
287
287
  Rename xr_dataset variables and attributes to match naming convention.
288
288
 
@@ -392,13 +392,18 @@ def makeL2asOwi(xr_dataset, dual_pol, copol, crosspol, add_streaks):
392
392
 
393
393
  xr_dataset = xr_dataset.rename({
394
394
  'dsig_cross': 'owiDsig_cross',
395
- 'nesz_cross_final': 'owiNesz_cross_final',
396
395
  'winddir_cross': 'owiWindDirection_cross',
397
396
  'winddir_dual': 'owiWindDirection',
398
397
  'windspeed_cross': 'owiWindSpeed_cross',
399
398
  'windspeed_dual': 'owiWindSpeed',
400
399
  'sigma0_detrend_cross': 'owiNrcs_detrend_cross'
401
400
  })
401
+
402
+ if apply_flattening:
403
+ xr_dataset = xr_dataset.rename({
404
+ 'nesz_cross_flattened': 'owiNesz_cross_flattened',
405
+ })
406
+
402
407
  # nrcs cross
403
408
  xr_dataset['owiNrcs_cross'] = xr_dataset['sigma0_ocean'].sel(
404
409
  pol=crosspol)
@@ -635,15 +640,7 @@ def preprocess(filename, outdir, config_path, overwrite=False, add_streaks=False
635
640
  config["l2_params"]["model_cross"] = model_cross
636
641
  config["sensor_longname"] = sensor_longname
637
642
 
638
- # need to load gmfs before inversion
639
- gmfs_impl = [x for x in [model_co, model_cross] if "gmf_" in x]
640
- windspeed.gmfs.GmfModel.activate_gmfs_impl(gmfs_impl)
641
- sarwings_luts = [x for x in [model_co, model_cross]
642
- if x.startswith("sarwing_lut_")]
643
-
644
- if len(sarwings_luts) > 0:
645
- windspeed.register_sarwing_luts(getConf()["sarwing_luts_path"])
646
-
643
+ # need to load LUTs before inversion
647
644
  nc_luts = [x for x in [model_co, model_cross] if x.startswith("nc_lut")]
648
645
 
649
646
  if len(nc_luts) > 0:
@@ -767,22 +764,17 @@ def preprocess(filename, outdir, config_path, overwrite=False, add_streaks=False
767
764
  xr_dataset['sigma0_detrend_cross'] = xsarsea.sigma0_detrend(
768
765
  xr_dataset.sigma0.sel(pol=crosspol), xr_dataset.incidence, model=model_cross)
769
766
  if config["apply_flattening"]:
770
- xr_dataset = xr_dataset.assign(nesz_cross_final=(
767
+ xr_dataset = xr_dataset.assign(nesz_cross_flattened=(
771
768
  ['line', 'sample'], windspeed.nesz_flattening(xr_dataset.nesz.sel(pol=crosspol), xr_dataset.incidence)))
772
- xr_dataset['nesz_cross_final'].attrs[
769
+ xr_dataset['nesz_cross_flattened'].attrs[
773
770
  "comment"] = 'nesz has been flattened using windspeed.nesz_flattening'
774
-
771
+ # dsig
772
+ xr_dataset["dsig_cross"] = windspeed.get_dsig(config["dsig_"+crosspol_gmf+"_NAME"], xr_dataset.incidence,
773
+ xr_dataset['sigma0_ocean'].sel(pol=crosspol), xr_dataset.nesz_cross_flattened)
775
774
  else:
776
- xr_dataset = xr_dataset.assign(
777
- nesz_cross_final=(['line', 'sample'], xr_dataset.nesz.sel(pol=crosspol).values))
778
- xr_dataset['nesz_cross_final'].attrs["comment"] = 'nesz has not been flattened'
779
-
780
- xr_dataset.nesz_cross_final.attrs['units'] = 'm^2 / m^2'
781
- xr_dataset.nesz_cross_final.attrs['long_name'] = 'Noise Equivalent SigmaNaught'
782
-
783
- # dsig
784
- xr_dataset["dsig_cross"] = windspeed.get_dsig(config["dsig_"+crosspol_gmf+"_NAME"], xr_dataset.incidence,
785
- xr_dataset['sigma0_ocean'].sel(pol=crosspol), xr_dataset.nesz_cross_final)
775
+ # dsig
776
+ xr_dataset["dsig_cross"] = windspeed.get_dsig(config["dsig_"+crosspol_gmf+"_NAME"], xr_dataset.incidence,
777
+ xr_dataset['sigma0_ocean'].sel(pol=crosspol), xr_dataset['sigma0_ocean'].sel(pol=crosspol))
786
778
 
787
779
  xr_dataset.dsig_cross.attrs['comment'] = 'variable used to ponderate copol and crosspol'
788
780
  xr_dataset.dsig_cross.attrs['formula_used'] = config["dsig_" +
@@ -936,8 +928,7 @@ def makeL2(filename, outdir, config_path, overwrite=False, generateCSV=True, add
936
928
 
937
929
  xr_dataset['winddir_dual'] = transform_winddir(
938
930
  wind_dual, xr_dataset.ground_heading, winddir_convention=config["winddir_convention"])
939
- xr_dataset['winddir_dual'].attrs["model"] = "%s (%s) & %s (%s)" % (
940
- model_co, copol, model_cross, crosspol)
931
+ xr_dataset["winddir_dual"].attrs["model"] = "winddir_dual is a copy of copol wind direction"
941
932
 
942
933
  xr_dataset = xr_dataset.assign(
943
934
  windspeed_cross=(['line', 'sample'], windspeed_cr))
@@ -949,7 +940,7 @@ def makeL2(filename, outdir, config_path, overwrite=False, generateCSV=True, add
949
940
 
950
941
  xr_dataset['winddir_cross'] = xr_dataset['winddir_dual'].copy()
951
942
  xr_dataset['winddir_cross'].attrs = xr_dataset['winddir_dual'].attrs
952
- xr_dataset["winddir_cross"].attrs["model"] = "No model used ; content is a copy of dualpol wind direction"
943
+ xr_dataset["winddir_cross"].attrs["model"] = "winddir_cross is a copy of copol wind direction"
953
944
 
954
945
  if config["winddir_convention"] == "oceanographic":
955
946
  attrs = xr_dataset['ancillary_wind_direction'].attrs
@@ -960,7 +951,7 @@ def makeL2(filename, outdir, config_path, overwrite=False, generateCSV=True, add
960
951
  "long_name"] = f"{ancillary_name} wind direction in oceanographic convention (clockwise, to), ex: 0°=to north, 90°=to east"
961
952
 
962
953
  xr_dataset, encoding = makeL2asOwi(
963
- xr_dataset, dual_pol, copol, crosspol, add_streaks=add_streaks)
954
+ xr_dataset, dual_pol, copol, crosspol, add_streaks=add_streaks, apply_flattening=config["apply_flattening"])
964
955
 
965
956
  #  add attributes
966
957
  firstMeasurementTime = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: grdwindinversion
3
- Version: 0.2.4
3
+ Version: 0.2.5
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,20 +1,19 @@
1
1
  grdwindinversion/.gitignore,sha256=vmDRHGeESYckUdUztsPr7u6ZNfBYMCVR3GE3AJCBnsY,1204
2
- grdwindinversion/.travis.yml,sha256=q13Gro7mMK7xN5eDEhyMIgcXIYsgSQfAEzk4dv34ie0,694
3
2
  grdwindinversion/__init__.py,sha256=VQc2V_j124NX2Gp06Go1oSZDSF4lBIVPYT-W9ZkNBXE,415
4
3
  grdwindinversion/config_prod.yaml,sha256=sYF1TAYM5ifFqlGdVwz8ygydo3_6KnEqYb7eBWYeDiw,1047
5
4
  grdwindinversion/config_prod_recal.yaml,sha256=WzucOsKVCK-lw5kRn-4llONwBxl8TogYrReeLycXC6k,1006
6
5
  grdwindinversion/data_config.yaml,sha256=YbbgxqpgasR5RINO29Ep_1cELdZotoylLzn6Qh7f6LM,473
7
- grdwindinversion/inversion.py,sha256=NRHZdbkozNSF-JRnnr5o3JYJtKZLM4EVgOJ0oJONqM0,47639
6
+ grdwindinversion/inversion.py,sha256=8--TyUzvsb3m9I2ajGelW_Fj2Us3kzKZrr9aysX4vxE,47299
8
7
  grdwindinversion/load_config.py,sha256=bt7EXTmXfbuK0oNR-qwtijv_iZBQzi5BtY92RGKEo4Y,651
9
8
  grdwindinversion/main.py,sha256=0DLDW0i14CWhDKAGegzOKlWnCkag_cGn3vzMIAKcv4g,2658
10
9
  grdwindinversion/streaks.py,sha256=SucALdajwAr-tcqwJs6KOj8CQ7qQPp3JUKSh2dHAJTY,2950
11
10
  grdwindinversion/utils.py,sha256=WmHL-NFv3B0PDbCauhBMeqW2ue_340iALmPH1kSd_Pc,2593
12
11
  grdwindinversion/utils_memory.py,sha256=1N3Kh4qVZPELPU6I4onbmkur1CZd7EHZqfbSAa6eaVc,1480
13
12
  grdwindinversion/.github/ISSUE_TEMPLATE.md,sha256=qiM_a7CCUz3fSrz3Q20Se1nwPNFS8QCc8tkwK_0DSCo,327
14
- grdwindinversion-0.2.4.dist-info/AUTHORS.rst,sha256=KmhW_5LBKGTIGwWEVkoTm1qx_bvdDR3yYL-1cwbDOFQ,218
15
- grdwindinversion-0.2.4.dist-info/LICENSE,sha256=-B8mBiTeY3J7OLuayiV1myqmc7yeijBc7s34kc8RTmg,1075
16
- grdwindinversion-0.2.4.dist-info/METADATA,sha256=NDJbyIEKTwJi5Uz9KPJj6o1zqvitYAd2A_5YBGrdAHQ,2392
17
- grdwindinversion-0.2.4.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
18
- grdwindinversion-0.2.4.dist-info/entry_points.txt,sha256=2rjvlVCy0iasRXjOz3kOIGuy2OCGQ-VTNuwuViQ6cMM,95
19
- grdwindinversion-0.2.4.dist-info/top_level.txt,sha256=z6lPix3QPEYOo37qq8plA2hY7S3C8MQZY81agRlksMI,17
20
- grdwindinversion-0.2.4.dist-info/RECORD,,
13
+ grdwindinversion-0.2.5.dist-info/AUTHORS.rst,sha256=KmhW_5LBKGTIGwWEVkoTm1qx_bvdDR3yYL-1cwbDOFQ,218
14
+ grdwindinversion-0.2.5.dist-info/LICENSE,sha256=-B8mBiTeY3J7OLuayiV1myqmc7yeijBc7s34kc8RTmg,1075
15
+ grdwindinversion-0.2.5.dist-info/METADATA,sha256=ei8sU-TLmzUASSVL80h4zQVwV83MHApbNidM9yriEJA,2392
16
+ grdwindinversion-0.2.5.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
17
+ grdwindinversion-0.2.5.dist-info/entry_points.txt,sha256=2rjvlVCy0iasRXjOz3kOIGuy2OCGQ-VTNuwuViQ6cMM,95
18
+ grdwindinversion-0.2.5.dist-info/top_level.txt,sha256=z6lPix3QPEYOo37qq8plA2hY7S3C8MQZY81agRlksMI,17
19
+ grdwindinversion-0.2.5.dist-info/RECORD,,
@@ -1,28 +0,0 @@
1
- # Config file for automatic testing at travis-ci.com
2
-
3
- language: python
4
- python:
5
- - 3.8
6
- - 3.7
7
- - 3.6
8
-
9
- # Command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
10
- install: pip install -U tox-travis
11
-
12
- # Command to run tests, e.g. python setup.py test
13
- script: tox
14
-
15
- # Assuming you have installed the travis-ci CLI tool, after you
16
- # create the Github repo and add it to Travis, run the
17
- # following command to finish PyPI deployment setup:
18
- # $ travis encrypt --add deploy.password
19
- deploy:
20
- provider: pypi
21
- distributions: sdist bdist_wheel
22
- user: agrouaze
23
- password:
24
- secure: PLEASE_REPLACE_ME
25
- on:
26
- tags: true
27
- repo: agrouaze/grdwindinversion
28
- python: 3.8