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

transform inputs to sub-packages #6

Open
EddyCMWF opened this issue Jun 27, 2023 · 3 comments
Open

transform inputs to sub-packages #6

EddyCMWF opened this issue Jun 27, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@EddyCMWF
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

I'm always frustrated that I have to change the format of my data when calling a method from a sub-package.

Describe the solution you'd like

I'd like the input-objects to be automatically transformed to the correct type by earthkit, usinng the functionality that is available in earthkit-data.

Describe alternatives you've considered

No response

Additional context

Implementation will require knowledge of the data formats required by the sub-package methods. This can be inspected using:

  1. Type-setting
  2. Consistant signitures in variable names, e.g. data = np.ndarray and dataarray = xr.DataArray
  3. Bespoke setting at the function level

For efficient code implementation, it is probably best to use function wrappers instead of decorators. Decorators would require code additions for all functions in the sub-package, whereas a wrapped can be applied programatically. Negative aspect is it may be slower at importing.

Organisation

ECMWF

@EddyCMWF EddyCMWF added the enhancement New feature or request label Jun 27, 2023
@EddyCMWF EddyCMWF self-assigned this Jun 27, 2023
@sandorkertesz
Copy link
Collaborator

Hi @EddyCMWF , I saw your work in branch 6-transform-inputs-to-sub-packages but I am not sure this should be done in theearthkit repo itself. In my opinion earthkitshould not contain any Python code apart from simply importing the components. Besides, components should not depend on the existence of earthkit since we should be able to install them independently. Is it not possible to achieve what you want in one of the components that the others would use?

@tlmquintino
Copy link
Member

Maybe we could consider making a earthkit-utils ?

@EddyCMWF
Copy link
Collaborator Author

EddyCMWF commented Jun 30, 2023

Oh, I just created this issue in earthkit-data: ecmwf/earthkit-data#134 .

I think it may be good to put it in there (for now at least) as it is all based on using earthkit-data to do the conversions.

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

When branches are created from issues, their pull requests are automatically linked.

3 participants