grdwindinversion 0.2.6__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.
- grdwindinversion/inversion.py +12 -12
- grdwindinversion/utils.py +1 -1
- {grdwindinversion-0.2.6.dist-info → grdwindinversion-0.2.7.dist-info}/METADATA +1 -1
- {grdwindinversion-0.2.6.dist-info → grdwindinversion-0.2.7.dist-info}/RECORD +9 -9
- {grdwindinversion-0.2.6.dist-info → grdwindinversion-0.2.7.dist-info}/WHEEL +1 -1
- {grdwindinversion-0.2.6.dist-info → grdwindinversion-0.2.7.dist-info}/AUTHORS.rst +0 -0
- {grdwindinversion-0.2.6.dist-info → grdwindinversion-0.2.7.dist-info}/LICENSE +0 -0
- {grdwindinversion-0.2.6.dist-info → grdwindinversion-0.2.7.dist-info}/entry_points.txt +0 -0
- {grdwindinversion-0.2.6.dist-info → grdwindinversion-0.2.7.dist-info}/top_level.txt +0 -0
grdwindinversion/inversion.py
CHANGED
|
@@ -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']
|
|
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']
|
|
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)))
|
|
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']
|
|
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']
|
|
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
|
|
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']
|
|
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.
|
|
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:
|
|
@@ -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=
|
|
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=
|
|
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.
|
|
14
|
-
grdwindinversion-0.2.
|
|
15
|
-
grdwindinversion-0.2.
|
|
16
|
-
grdwindinversion-0.2.
|
|
17
|
-
grdwindinversion-0.2.
|
|
18
|
-
grdwindinversion-0.2.
|
|
19
|
-
grdwindinversion-0.2.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|