@@ -532,7 +532,7 @@ def open_pol_dataset(
532532 annotation : esa_safe .PathOrFileType ,
533533 fs : Optional [fsspec .AbstractFileSystem ] = None ,
534534 attrs : Dict [str , Any ] = {},
535- geospatial_attrs : bool = False ,
535+ gcp : Optional [ xr . Dataset ] = None ,
536536) -> xr .Dataset :
537537
538538 product_information = esa_safe .parse_tag (annotation , ".//productInformation" )
@@ -651,8 +651,7 @@ def open_pol_dataset(
651651 arr = arr .assign_coords (coords ) # type: ignore
652652 arr = arr .swap_dims (swap_dims )
653653
654- if geospatial_attrs :
655- gcp = open_gcp_dataset (annotation )
654+ if gcp :
656655 attrs .update (gcp .attrs ) # type: ignore
657656
658657 arr .attrs .update (attrs )
@@ -920,7 +919,7 @@ def open_sentinel1_dataset(
920919 storage_options : Optional [Dict [str , Any ]] = None ,
921920 check_files_exist : bool = False ,
922921 override_product_files : Optional [str ] = None ,
923- geospatial_attrs : bool = False ,
922+ parse_geospatial_attrs : bool = True ,
924923) -> xr .Dataset :
925924 if drop_variables is not None :
926925 warnings .warn ("'drop_variables' is currently ignored" )
@@ -949,6 +948,7 @@ def open_sentinel1_dataset(
949948 metadata = ""
950949
951950 ds = xr .Dataset (attrs = common_attrs )
951+ gcp = None
952952 if group == "" :
953953 subgroups = list (groups )
954954 else :
@@ -958,12 +958,15 @@ def open_sentinel1_dataset(
958958
959959 if group .count ("/" ) == 1 :
960960 with fs .open (groups [group ][1 ]) as annotation :
961+ if parse_geospatial_attrs :
962+ gcp = open_gcp_dataset (annotation , attrs = common_attrs )
963+
961964 ds = open_pol_dataset (
962965 groups [group ][0 ],
963966 annotation ,
964967 fs = fs ,
965968 attrs = common_attrs ,
966- geospatial_attrs = geospatial_attrs ,
969+ gcp = gcp ,
967970 )
968971 elif group .count ("/" ) == 2 :
969972 _ , _ , metadata = group .split ("/" , 2 )
@@ -975,7 +978,7 @@ def open_sentinel1_dataset(
975978 ds .attrs ["subgroups" ] = subgroups
976979
977980 if group .count ("/" ) == 1 and burst_index is not None :
978- ds = crop_burst_dataset (ds , burst_index = burst_index )
981+ ds = crop_burst_dataset (ds , burst_index = burst_index , gcp = gcp )
979982
980983 conventions .update_attributes (ds , group = metadata )
981984
0 commit comments