CLIMADA-project / climada_python

Python (3.8+) version of CLIMADA
GNU General Public License v3.0
324 stars 125 forks source link

Remove superfluous `from_` classmethods in Centroids #698

Open peanutfun opened 1 year ago

peanutfun commented 1 year ago

As far as I can see, nobody reads in Centroids on their own. Reading/creating centroids is always part of reading in Hazard data (...or is it?). Therefore, I see no reason why we should keep from_ classmethods in Centroids that are not used anywhere else. I compiled a list of these methods. The following classmethods are only called by tests, and not by any other code in either Climada Core or Petals:

Can we remove them?

chahank commented 1 year ago

Sometimes it is useful to be able to create Centroids separately from the Hazard. But I would agree that we can remove the said methods. These operations can easily be done otherwise just from the __init__.

peanutfun commented 1 year ago

Both methods have been deprecated with #721 and can be removed after the next release.

chahank commented 11 months ago

This had been reversed in the latest rewriting of the Centroids as geodataframe. I think it is still in general useful to have the possibility to create ones own centroids. For instance, when creating a tropical cyclone object with local storms, but on a standardized global set of centroids.

I would close this issue if this is fine with you @peanutfun .

peanutfun commented 11 months ago

@chahank This issue is about removing only from_geodataframe and from_pix_bounds. We already deprecated them. Do you now want to keep them in?

chahank commented 11 months ago

These methods are part of the centroids currently (and not deprecated). I think this is good like this. Centroids are now much slimmer and thus having a method to make centroids sound useful.

Would you insist on removing them? Then how would centroids be initialized?

chahank commented 11 months ago

To be clear, now there are 3 from_ methods: