grdwindinversion 0.2.5__py3-none-any.whl → 0.2.7__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.
@@ -101,7 +101,7 @@ def getOutputName2(input_file, outdir, sensor, meta, subdir=True):
101
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.lower()}-owi-xx-{meta_start_date.lower()}-{meta_stop_date.lower()}-_____-_____.nc"
104
+ new_format = f"{MISSIONID.lower()}-{BEAM_MODE.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)
@@ -607,6 +607,9 @@ def preprocess(filename, outdir, config_path, overwrite=False, add_streaks=False
607
607
  logging.error(e)
608
608
  sys.exit(-1)
609
609
 
610
+ # load
611
+ xr_dataset = xr_dataset.load()
612
+
610
613
  # defining dual_pol, and gmfs by channel
611
614
  if len(xr_dataset.pol.values) == 2:
612
615
  dual_pol = True
@@ -707,7 +710,7 @@ def preprocess(filename, outdir, config_path, overwrite=False, add_streaks=False
707
710
  90. - np.rad2deg(np.arctan2(xr_dataset.model_V10, xr_dataset.model_U10)) + 180) % 360
708
711
 
709
712
  xr_dataset['ancillary_wind_direction'] = xr.where(xr_dataset['mask'], np.nan,
710
- xr_dataset['ancillary_wind_direction'].compute()).transpose(
713
+ xr_dataset['ancillary_wind_direction']).transpose(
711
714
  *xr_dataset['ancillary_wind_direction'].dims)
712
715
  xr_dataset['ancillary_wind_direction'].attrs = {}
713
716
  xr_dataset['ancillary_wind_direction'].attrs['units'] = 'degrees_north'
@@ -718,7 +721,7 @@ def preprocess(filename, outdir, config_path, overwrite=False, add_streaks=False
718
721
  xr_dataset['ancillary_wind_speed'] = np.sqrt(
719
722
  xr_dataset['model_U10']**2+xr_dataset['model_V10']**2)
720
723
  xr_dataset['ancillary_wind_speed'] = xr.where(xr_dataset['mask'], np.nan,
721
- xr_dataset['ancillary_wind_speed'].compute()).transpose(
724
+ xr_dataset['ancillary_wind_speed']).transpose(
722
725
  *xr_dataset['ancillary_wind_speed'].dims)
723
726
  xr_dataset['ancillary_wind_speed'].attrs = {}
724
727
  xr_dataset['ancillary_wind_speed'].attrs['units'] = 'm s^-1'
@@ -727,7 +730,7 @@ def preprocess(filename, outdir, config_path, overwrite=False, add_streaks=False
727
730
  xr_dataset['ancillary_wind_speed'].attrs['standart_name'] = 'wind_speed'
728
731
 
729
732
  xr_dataset['ancillary_wind'] = xr.where(xr_dataset['mask'], np.nan,
730
- (xr_dataset.ancillary_wind_speed * np.exp(1j * xsarsea.dir_meteo_to_sample(xr_dataset.ancillary_wind_direction, xr_dataset.ground_heading))).compute()).transpose(
733
+ (xr_dataset.ancillary_wind_speed * np.exp(1j * xsarsea.dir_meteo_to_sample(xr_dataset.ancillary_wind_direction, xr_dataset.ground_heading)))).transpose(
731
734
  *xr_dataset['ancillary_wind_speed'].dims)
732
735
 
733
736
  xr_dataset.attrs['ancillary_source'] = xr_dataset['model_U10'].attrs['history'].split('decoded: ')[
@@ -736,7 +739,7 @@ def preprocess(filename, outdir, config_path, overwrite=False, add_streaks=False
736
739
 
737
740
  # nrcs processing
738
741
  xr_dataset['sigma0_ocean'] = xr.where(xr_dataset['mask'], np.nan,
739
- xr_dataset['sigma0'].compute()).transpose(*xr_dataset['sigma0'].dims)
742
+ xr_dataset['sigma0']).transpose(*xr_dataset['sigma0'].dims)
740
743
  xr_dataset['sigma0_ocean'].attrs = xr_dataset['sigma0'].attrs
741
744
  #  we forced it to 1e-15
742
745
  xr_dataset['sigma0_ocean'].attrs['comment'] = "clipped, no values <=0 ; 1e-15 instread"
@@ -751,7 +754,7 @@ def preprocess(filename, outdir, config_path, overwrite=False, add_streaks=False
751
754
  xr_dataset['sigma0_ocean'] <= 0, 1e-15, xr_dataset['sigma0_ocean'])
752
755
 
753
756
  xr_dataset['sigma0_ocean_raw'] = xr.where(xr_dataset['mask'], np.nan,
754
- xr_dataset['sigma0_raw'].compute()).transpose(*xr_dataset['sigma0_raw'].dims)
757
+ xr_dataset['sigma0_raw']).transpose(*xr_dataset['sigma0_raw'].dims)
755
758
 
756
759
  xr_dataset['sigma0_ocean_raw'].attrs = xr_dataset['sigma0_raw'].attrs
757
760
 
@@ -765,7 +768,7 @@ def preprocess(filename, outdir, config_path, overwrite=False, add_streaks=False
765
768
  xr_dataset.sigma0.sel(pol=crosspol), xr_dataset.incidence, model=model_cross)
766
769
  if config["apply_flattening"]:
767
770
  xr_dataset = xr_dataset.assign(nesz_cross_flattened=(
768
- ['line', 'sample'], windspeed.nesz_flattening(xr_dataset.nesz.sel(pol=crosspol), xr_dataset.incidence)))
771
+ ['line', 'sample'], windspeed.nesz_flattening(xr_dataset.nesz.sel(pol=crosspol), xr_dataset.incidence).data))
769
772
  xr_dataset['nesz_cross_flattened'].attrs[
770
773
  "comment"] = 'nesz has been flattened using windspeed.nesz_flattening'
771
774
  # dsig
@@ -774,7 +777,7 @@ def preprocess(filename, outdir, config_path, overwrite=False, add_streaks=False
774
777
  else:
775
778
  # dsig
776
779
  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))
780
+ xr_dataset['sigma0_ocean'].sel(pol=crosspol), xr_dataset.nesz.sel(pol=crosspol))
778
781
 
779
782
  xr_dataset.dsig_cross.attrs['comment'] = 'variable used to ponderate copol and crosspol'
780
783
  xr_dataset.dsig_cross.attrs['formula_used'] = config["dsig_" +
@@ -819,7 +822,7 @@ def preprocess(filename, outdir, config_path, overwrite=False, add_streaks=False
819
822
  xr_dataset_100.land_mask.values = binary_dilation(xr_dataset_100['land_mask'].values.astype('uint8'),
820
823
  structure=np.ones((3, 3), np.uint8), iterations=3)
821
824
  xr_dataset_100['sigma0_detrend'] = xr.where(
822
- xr_dataset_100['land_mask'], np.nan, xr_dataset_100['sigma0'].compute()).transpose(*xr_dataset_100['sigma0'].dims)
825
+ xr_dataset_100['land_mask'], np.nan, xr_dataset_100['sigma0']).transpose(*xr_dataset_100['sigma0'].dims)
823
826
 
824
827
  xr_dataset['streaks_direction'] = get_streaks(
825
828
  xr_dataset, xr_dataset_100)
@@ -899,8 +902,6 @@ def makeL2(filename, outdir, config_path, overwrite=False, generateCSV=True, add
899
902
  model_co=model_co,
900
903
  model_cross=model_cross,
901
904
  ** kwargs)
902
- wind_co.compute()
903
-
904
905
  # windspeed_co
905
906
  xr_dataset['windspeed_co'] = np.abs(wind_co)
906
907
  xr_dataset["windspeed_co"].attrs["units"] = "m.s⁻1"
@@ -917,7 +918,6 @@ def makeL2(filename, outdir, config_path, overwrite=False, generateCSV=True, add
917
918
 
918
919
  # windspeed_dual / windspeed_cr / /winddir_dual / winddir_cr
919
920
  if dual_pol and wind_dual is not None:
920
- wind_dual.compute()
921
921
  xr_dataset['windspeed_dual'] = np.abs(wind_dual)
922
922
  xr_dataset["windspeed_dual"].attrs["units"] = "m.s⁻1"
923
923
  xr_dataset["windspeed_dual"].attrs["long_name"] = "Wind speed inverted from model %s (%s) & %s (%s)" % (
@@ -931,7 +931,7 @@ def makeL2(filename, outdir, config_path, overwrite=False, generateCSV=True, add
931
931
  xr_dataset["winddir_dual"].attrs["model"] = "winddir_dual is a copy of copol wind direction"
932
932
 
933
933
  xr_dataset = xr_dataset.assign(
934
- windspeed_cross=(['line', 'sample'], windspeed_cr))
934
+ windspeed_cross=(['line', 'sample'], windspeed_cr.data))
935
935
  xr_dataset["windspeed_cross"].attrs["units"] = "m.s⁻1"
936
936
  xr_dataset["windspeed_cross"].attrs["long_name"] = "Wind Speed inverted from model %s (%s)" % (
937
937
  model_cross, crosspol)
grdwindinversion/utils.py CHANGED
@@ -34,7 +34,7 @@ def check_incidence_range(incidence, models, **kwargs):
34
34
  f"GMF {model_name} inc_range will be changed by kwargs to {kwargs['inc_range']}")
35
35
  lut_range = kwargs['inc_range']
36
36
 
37
- inc_range = [incidence.values.min(), incidence.values.max()]
37
+ inc_range = [incidence.min(), incidence.max()]
38
38
  if (inc_range[0] >= lut_range[0] and inc_range[1] <= lut_range[1]):
39
39
  rets.append(True)
40
40
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: grdwindinversion
3
- Version: 0.2.5
3
+ Version: 0.2.7
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
@@ -27,6 +27,9 @@ Requires-Dist: numpy
27
27
  Requires-Dist: scipy
28
28
  Requires-Dist: fsspec
29
29
  Requires-Dist: aiohttp
30
+ Requires-Dist: xarray-safe-s1
31
+ Requires-Dist: xradarsat2
32
+ Requires-Dist: xarray-safe-rcm
30
33
 
31
34
 
32
35
  # grdwindinversion
@@ -3,17 +3,17 @@ grdwindinversion/__init__.py,sha256=VQc2V_j124NX2Gp06Go1oSZDSF4lBIVPYT-W9ZkNBXE,
3
3
  grdwindinversion/config_prod.yaml,sha256=sYF1TAYM5ifFqlGdVwz8ygydo3_6KnEqYb7eBWYeDiw,1047
4
4
  grdwindinversion/config_prod_recal.yaml,sha256=WzucOsKVCK-lw5kRn-4llONwBxl8TogYrReeLycXC6k,1006
5
5
  grdwindinversion/data_config.yaml,sha256=YbbgxqpgasR5RINO29Ep_1cELdZotoylLzn6Qh7f6LM,473
6
- grdwindinversion/inversion.py,sha256=8--TyUzvsb3m9I2ajGelW_Fj2Us3kzKZrr9aysX4vxE,47299
6
+ grdwindinversion/inversion.py,sha256=zJt2HNoeqiQhNG5jKGUVe33HWbGeub1BRM1gPGoCcQo,47239
7
7
  grdwindinversion/load_config.py,sha256=bt7EXTmXfbuK0oNR-qwtijv_iZBQzi5BtY92RGKEo4Y,651
8
8
  grdwindinversion/main.py,sha256=0DLDW0i14CWhDKAGegzOKlWnCkag_cGn3vzMIAKcv4g,2658
9
9
  grdwindinversion/streaks.py,sha256=SucALdajwAr-tcqwJs6KOj8CQ7qQPp3JUKSh2dHAJTY,2950
10
- grdwindinversion/utils.py,sha256=WmHL-NFv3B0PDbCauhBMeqW2ue_340iALmPH1kSd_Pc,2593
10
+ grdwindinversion/utils.py,sha256=UK-ACGAFktiQaINzFFa1rtD-Vd1StXn4_n4-6t4yefc,2579
11
11
  grdwindinversion/utils_memory.py,sha256=1N3Kh4qVZPELPU6I4onbmkur1CZd7EHZqfbSAa6eaVc,1480
12
12
  grdwindinversion/.github/ISSUE_TEMPLATE.md,sha256=qiM_a7CCUz3fSrz3Q20Se1nwPNFS8QCc8tkwK_0DSCo,327
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,,
13
+ grdwindinversion-0.2.7.dist-info/AUTHORS.rst,sha256=KmhW_5LBKGTIGwWEVkoTm1qx_bvdDR3yYL-1cwbDOFQ,218
14
+ grdwindinversion-0.2.7.dist-info/LICENSE,sha256=-B8mBiTeY3J7OLuayiV1myqmc7yeijBc7s34kc8RTmg,1075
15
+ grdwindinversion-0.2.7.dist-info/METADATA,sha256=aBCWc9uXi9BHTtGdTldSQpjLGXdYnhYFljOYDNjhFn0,2479
16
+ grdwindinversion-0.2.7.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
17
+ grdwindinversion-0.2.7.dist-info/entry_points.txt,sha256=2rjvlVCy0iasRXjOz3kOIGuy2OCGQ-VTNuwuViQ6cMM,95
18
+ grdwindinversion-0.2.7.dist-info/top_level.txt,sha256=z6lPix3QPEYOo37qq8plA2hY7S3C8MQZY81agRlksMI,17
19
+ grdwindinversion-0.2.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5