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

`Regions2D.close_region()` return `SettingWithCopyWarning` warnings #132

Open leewujung opened 11 months ago

leewujung commented 11 months ago

I tried doing

r2d_manual.data = r2d_manual.close_region(region=region_id_manual_hake)

The operation went through but returned the warning messages below. It would be good to fix this so that we are careful about the caveats.

Warning messages:

/home/ec2-user/miniconda3/envs/hake_nasc_torch/lib/python3.11/site-packages/echoregions/regions2d/regions2d.py:229: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  region["time"] = region.apply(
/home/ec2-user/miniconda3/envs/hake_nasc_torch/lib/python3.11/site-packages/echoregions/regions2d/regions2d.py:232: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  region["depth"] = region.apply(