earthkit-data icon indicating copy to clipboard operation
earthkit-data copied to clipboard

How to access latitudes/longitudes on a GribField and FieldList?

Open sandorkertesz opened this issue 1 year ago • 0 comments

At the moment we can access latitudes/longitudes on a GribField as follows (ds is a FieldList in the examples below):

This call returns a dict: {"lat": array, "lon": array}

ds[0].to_latlon()

This call returns a tuple (lat-array, lon-array):

ds[0].data(["lat", "lon"])

This call returns only the latitudes (as an array):

ds[0].data("lat")

We can even use metadata to get the latitudes, though this type of usage should be discouraged:

ds[0].metadata("latitudes")

On a FieldList we can only call metadata out of these methods, which would return a list of arrays (one per GribField):

ds.metadata("latitudes")

The following questions arise:

  • should we add the convenience methods latitudes and longitudes to GribField?
  • should we add to_latlon to FieldList?
  • should we add data to FieldList?
  • should we add latitudes and longitudes (if we implement them on GribField) to FieldList?

sandorkertesz avatar Jun 14 '23 09:06 sandorkertesz