OSOceanAcoustics / echoregions

Interfacing water column sonar data with annotations and labels
https://echoregions.readthedocs.io/
Apache License 2.0
6 stars 6 forks source link

Is `region_id` required to be an integer? #211

Open leewujung opened 3 months ago

leewujung commented 3 months ago

So I have run into this situation where I have the region_id from multiple EVR files, and I merged the Regions2D.data dataframe and then saved the rows I want into a csv file. Then I used read_region_csv to read the csv back as a Regions2D object. However, during the merging of multiple r2d.data dataframes, I had to alter the values of region_id so that the ids are unique, otherwise read_region_csv will throw error. The change I made was something like 0707_17, for a region from July 7, region_id=7, just so that the region_id would not be identical with region_id from other EVRs, like below:

Screenshot 2024-08-09 at 6 30 53 PM

But when the csv was read back into a Regions2D using read_region_csv, the region_id column was read as int64:

Screenshot 2024-08-09 at 6 31 13 PM

From the code it seems that the only place we require region_id to be an int is when creating it from the EVR file since it was from text. I wonder why this happens, and also wondering if region_id should always be an integer, or that we allow it to be other type too? In that case I guess I can explicitly cast it before saving?

@ctuguinay have you run into something like this before?