-
Notifications
You must be signed in to change notification settings - Fork 143
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
Improve repr
s for key Parcels classes
#1693
Comments
Hi, |
Thanks for offering to contribute to this Issue, @rehamansoor! I don't have a very clear idea what to print in mind yet, but was inspired by the html-version Since a |
Hi @rehamansoor, great to hear that you’re interested in this issue. Before the wall of text that is about to follow, please let me know if you have any questions about anything below, or if you'd like any clarification. I'm not sure what your Python level is so - if you feel like this is a bit much for where you're at - let me know (there are issues in the codebase that are better suited to new Python developers 😁). I imagine these won't all be fixed in one PR, or by the same person. Useful reference
TLDR: I think we shouldn't do HTML outputs for now. Let's focus on text reprs
HTML repr outputs would be amazing in theory, but after doing some diving into the implementation in xarray (see entrypoint import xarray as xr
import numpy as np
import pandas as pd
ds = xr.Dataset(
data_vars=dict(
temperature=(["loc", "time"], np.random.randn(2, 4)),
precipitation=(["loc", "time"], 10 * np.random.rand(2, 4)),
),
coords=dict(
lat=("loc", [42.25, 42.21]),
time=pd.date_range("2014-09-06", periods=4),
reference_time=pd.Timestamp("2014-09-05"),
),
attrs=dict(description="Weather related data."),
)
print(ds._repr_html_()) I think there is quite some room for improvement in our text reprs (we'll need them anyway for scripts) and down the line see if there is a need for HTML ones as well (/investigate how we can better customise iPython notebooks output). At the moment the apparent complexity/maintenance burden makes me hesitate. Note customising iPython notebook reprs is easily done with the Starting with the smallest objects to the largest, this is the information (
I would recommend working on the simple reprs first. Also at this stage we are not too concerned about user customising the repr output (like the This isn't the be-all and end-all for the reprs. We'll be reworking Parcels internals over the coming months cleaning things up. But having a starting point to go from would be super helpfull. If there are numpy arrays in the repr, please use the context manager |
Thank you for the detailed breakdown, and I apologize for the delay in replying—I got a bit busy with school. I really appreciate the opportunity to contribute. While I have experience in Python through my college courses, I think these tasks might be a bit complex for me at the moment. Could you suggest an issue that might be a better fit for my current skill level? I’m eager to help and continue improving my abilities. Thanks again, and I look forward to contributing! |
Hi @rehamansoor . All good! We do have a few issues that would be better suited: In #1620 with have the subtask |
bump |
print
for key Parcels classesrepr
s for key Parcels classes
So far, we haven't really worked on the output of
print()
on objects likeField
,FieldSet
etc. While there is aParticleSet.__repr__
, even that is pretty clunky and doesn't take into account notebook functionality.It would be nice to have better
print()
implementation for at least the following classesField
FieldSet
ParticleSet
Particle
ParticleFile
EDIT Vecko: Out of scopeKernel
(?)The text was updated successfully, but these errors were encountered: