Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metadata handling object #146

Closed
sandorkertesz opened this issue Jul 14, 2023 · 0 comments
Closed

Add metadata handling object #146

sandorkertesz opened this issue Jul 14, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@sandorkertesz
Copy link
Collaborator

sandorkertesz commented Jul 14, 2023

earthkit-data objects are immutable but when we perform computations we need to create new objects from existing ones. The computations in earthkit-meteo will always take numpy input and result in numpy output.
The following code snippet illustrates a possible workflow that:

  • starts from an earthkit-data object
  • performs the computations in earthkit-meteo using numpy arrays
  • generates a new earthkit-data object using the resulting array and the metadata from the original object
#ensemble is a GRIB fieldlist with 51 fields
np_efi = earthkit.meteo.efi(ensemble.to_numpy(), clim)

# option 1
metadata = ensemble[0].metadata().override(param=efi’)

# option 2
metadata = earthkit.data.Metadata(param=efi_param(ensemble[0]), template=ensemble[0])

fs_efi = earthkit.data.FieldList.from_numpy(np_efi, metadata)
fs_efi.save(…)

The key element here, regarding the current issue, is the metadata object. #107 provides guidelines for the concrete API it should implement.

@sandorkertesz sandorkertesz added the enhancement New feature or request label Jul 14, 2023
@sandorkertesz sandorkertesz self-assigned this Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant