From 9882a264c4e82a3cb98accde1dcab01976e4d631 Mon Sep 17 00:00:00 2001 From: tsutterley Date: Tue, 21 May 2024 12:41:12 -0700 Subject: [PATCH] feat: include ATL14 files in lineage --- DEM/interp_ATL14_DEM_ICESat2_ATL06.py | 8 ++++---- DEM/interp_ATL14_DEM_ICESat2_ATL11.py | 8 ++++---- DEM/interp_ATL14_DEM_ICESat_GLA12.py | 5 ++++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/DEM/interp_ATL14_DEM_ICESat2_ATL06.py b/DEM/interp_ATL14_DEM_ICESat2_ATL06.py index a69e0b8..f47f5bf 100644 --- a/DEM/interp_ATL14_DEM_ICESat2_ATL06.py +++ b/DEM/interp_ATL14_DEM_ICESat2_ATL06.py @@ -317,7 +317,7 @@ def interp_ATL14_DEM_ICESat2(INPUT_FILE, # write to output HDF5 file HDF5_ATL06_dem_write(IS2_atl06_dem, IS2_atl06_dem_attrs, FILENAME=OUTPUT_FILE, - INPUT=GRANULE, + INPUT=[GRANULE, *DEM_MODEL], FILL_VALUE=IS2_atl06_fill, DIMENSIONS=IS2_atl06_dims, CLOBBER=True) @@ -325,7 +325,7 @@ def interp_ATL14_DEM_ICESat2(INPUT_FILE, OUTPUT_FILE.chmod(mode=MODE) # PURPOSE: outputting the interpolated DEM data for ICESat-2 data to HDF5 -def HDF5_ATL06_dem_write(IS2_atl06_dem, IS2_atl06_attrs, INPUT=None, +def HDF5_ATL06_dem_write(IS2_atl06_dem, IS2_atl06_attrs, INPUT=[], FILENAME='', FILL_VALUE=None, DIMENSIONS=None, CLOBBER=True): # setting HDF5 clobber attribute if CLOBBER: @@ -445,8 +445,8 @@ def HDF5_ATL06_dem_write(IS2_atl06_dem, IS2_atl06_attrs, INPUT=None, fileID.attrs['source'] = 'Spacecraft' fileID.attrs['references'] = 'https://nsidc.org/data/icesat-2' fileID.attrs['processing_level'] = '4' - # add attributes for input ATL06 file - fileID.attrs['lineage'] = pathlib.Path(INPUT).name + # add attributes for input files + fileID.attrs['lineage'] = [pathlib.Path(i).name for i in INPUT] # find geospatial and temporal ranges lnmn,lnmx,ltmn,ltmx,tmn,tmx = (np.inf,-np.inf,np.inf,-np.inf,np.inf,-np.inf) for gtx in beams: diff --git a/DEM/interp_ATL14_DEM_ICESat2_ATL11.py b/DEM/interp_ATL14_DEM_ICESat2_ATL11.py index f9c31d2..46f2932 100644 --- a/DEM/interp_ATL14_DEM_ICESat2_ATL11.py +++ b/DEM/interp_ATL14_DEM_ICESat2_ATL11.py @@ -330,7 +330,7 @@ def interp_ATL14_DEM_ICESat2(INPUT_FILE, # write to output HDF5 file HDF5_ATL11_dem_write(IS2_atl11_dem, IS2_atl11_dem_attrs, FILENAME=OUTPUT_FILE, - INPUT=GRANULE, + INPUT=[GRANULE, *DEM_MODEL], FILL_VALUE=IS2_atl11_fill, DIMENSIONS=IS2_atl11_dims, CLOBBER=True) @@ -338,7 +338,7 @@ def interp_ATL14_DEM_ICESat2(INPUT_FILE, OUTPUT_FILE.chmod(mode=MODE) # PURPOSE: outputting the interpolated DEM data for ICESat-2 data to HDF5 -def HDF5_ATL11_dem_write(IS2_atl11_dem, IS2_atl11_attrs, INPUT=None, +def HDF5_ATL11_dem_write(IS2_atl11_dem, IS2_atl11_attrs, INPUT=[], FILENAME='', FILL_VALUE=None, DIMENSIONS=None, CLOBBER=True): # setting HDF5 clobber attribute if CLOBBER: @@ -448,8 +448,8 @@ def HDF5_ATL11_dem_write(IS2_atl11_dem, IS2_atl11_attrs, INPUT=None, fileID.attrs['source'] = 'Spacecraft' fileID.attrs['references'] = 'https://nsidc.org/data/icesat-2' fileID.attrs['processing_level'] = '4' - # add attributes for input ATL11 files - fileID.attrs['lineage'] = pathlib.Path(INPUT).name + # add attributes for input files + fileID.attrs['lineage'] = [pathlib.Path(i).name for i in INPUT] # find geospatial and temporal ranges lnmn,lnmx,ltmn,ltmx,tmn,tmx = (np.inf,-np.inf,np.inf,-np.inf,np.inf,-np.inf) for ptx in pairs: diff --git a/DEM/interp_ATL14_DEM_ICESat_GLA12.py b/DEM/interp_ATL14_DEM_ICESat_GLA12.py index 50c7d68..8c0f466 100644 --- a/DEM/interp_ATL14_DEM_ICESat_GLA12.py +++ b/DEM/interp_ATL14_DEM_ICESat_GLA12.py @@ -307,13 +307,14 @@ def interp_ATL14_DEM_ICESat(INPUT_FILE, HDF5_GLA12_dem_write(IS_gla12_dem, IS_gla12_dem_attrs, FILENAME=OUTPUT_FILE, FILL_VALUE=IS_gla12_fill, + INPUT=[GRANULE, *DEM_MODEL], CLOBBER=True) # change the permissions mode OUTPUT_FILE.chmod(mode=MODE) # PURPOSE: outputting the DEM values for ICESat data to HDF5 def HDF5_GLA12_dem_write(IS_gla12_tide, IS_gla12_attrs, - FILENAME='', FILL_VALUE=None, CLOBBER=False): + FILENAME='', INPUT=[], FILL_VALUE=None, CLOBBER=False): # setting HDF5 clobber attribute if CLOBBER: clobber = 'w' @@ -334,6 +335,8 @@ def HDF5_GLA12_dem_write(IS_gla12_tide, IS_gla12_attrs, # add software information fileID.attrs['software_reference'] = gz.version.project_name fileID.attrs['software_version'] = gz.version.full_version + # add attributes for input files + fileID.attrs['lineage'] = [pathlib.Path(i).name for i in INPUT] # create Data_40HZ group fileID.create_group('Data_40HZ')