Skip to content

Commit

Permalink
Change version attribute label and take version from version.py (whic…
Browse files Browse the repository at this point in the history
…h is automatically generated) instead of config_version.json
  • Loading branch information
tcevaer committed Oct 30, 2023
1 parent b16cfb5 commit ad628ff
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion coloc_sat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

__author__ = """Yann Reynaud"""
__email__ = 'yann.reynaud.2@ifremer.fr'
__version__ = '0.1.0'
__all__ = ['GetSarMeta', 'GetEra5Meta', 'GetHy2Meta', 'GetSmosMeta', 'GetWindSatMeta',
'GetSmapMeta', 'ProductIntersection', 'GenerateColoc']

from .version import __version__
from .sar_meta import GetSarMeta
from .era5_meta import GetEra5Meta
from .hy2_meta import GetHy2Meta
Expand Down
3 changes: 0 additions & 3 deletions coloc_sat/config_version.json

This file was deleted.

6 changes: 3 additions & 3 deletions coloc_sat/intersection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from .intersection_tools import extract_times_dataset, are_dimensions_empty, get_footprint_from_ll_ds, \
get_polygon_area_in_km_squared, get_transform, get_common_points, get_nearest_time_datasets, remove_nat
from .tools import mean_time_diff, reformat_meta, convert_str_to_polygon
from .version import __version__


logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -747,9 +749,7 @@ def get_common_attrs():
attrs['polygon_common_zone'] = poly_common_zone()
attrs['area_intersection'] = str(get_polygon_area_in_km_squared(attrs['polygon_common_zone']))
# add tool version to attributes
with open(Path(__file__).resolve().parent / "config_version.json", "r") as config_file:
config_data = json.load(config_file)
attrs['version'] = config_data["version"]
attrs['coloc_sat_version'] = __version__
return attrs

merged_ds = xr.merge([dataset1, dataset2], compat='override')
Expand Down

0 comments on commit ad628ff

Please sign in to comment.