Skip to content

Commit

Permalink
Merge pull request ASFHyP3#235 from ASFHyP3/multi_burst_names
Browse files Browse the repository at this point in the history
Lat/Lon String Formatting in Product Name
  • Loading branch information
mfangaritav authored Aug 15, 2024
2 parents 93756fc + 4e21974 commit b0469ff
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/hyp3_isce2/packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ def get_product_name(reference: str, secondary: str, pixel_spacing: int, slc: bo
orbit_number = ref_manifest_xml.find(relative_orbit_number_query).text.zfill(3)
footprint = get_geometry_from_manifest(Path(f'{reference}.SAFE/manifest.safe'))
lons, lats = footprint.exterior.coords.xy
lon_lims = [np.min(lons), np.max(lons)]
lat_lims = [np.min(lats), np.max(lats)]
lons = ['E'+str(abs(int(lon))) if lon >= 0 else 'W'+str(abs(int(lon))) for lon in lon_lims]
lats = ['N'+str(abs(int(lat))) if lat >= 0 else 'S'+str(abs(int(lat))) for lat in lat_lims]
name_parts = [platform, orbit_number, lons[0], lons[1], lats[0], lats[1]]
def lat_string(lat): return ('N' if lat >= 0 else 'S') + f"{('%.1f' % np.abs(lat)).zfill(4)}".replace('.', '_')
def lon_string(lon): return ('E' if lon >= 0 else 'W') + f"{('%.1f' % np.abs(lon)).zfill(5)}".replace('.', '_')
lat_lims = [lat_string(lat) for lat in [np.min(lats), np.max(lats)]]
lon_lims = [lon_string(lon) for lon in [np.min(lons), np.max(lons)]]
name_parts = [platform, orbit_number, lon_lims[0], lat_lims[0], lon_lims[1], lat_lims[1]]
else:
platform = reference_split[0]
burst_id = reference_split[1]
Expand Down

0 comments on commit b0469ff

Please sign in to comment.