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

Return map potential data from Map Plots #305

Closed
wants to merge 1 commit into from
Closed

Conversation

shibaji7
Copy link

@shibaji7 shibaji7 commented Mar 7, 2023

Map potential data

Return fitted potential / velocity / e-field datasets from Map potential data plots. This enhancement will help to share the fitted datasets for event analysis in various conjunction studies using SuperDARN. @bharatreddy @Shirling-VT @carleyjmartin

Approval

Number of approvals: 2 (testing and code review where possible)

Test

@bharatreddy
Copy link
Collaborator

bharatreddy commented Mar 8, 2023

Why change the "plot_mapdata" function (

def plot_mapdata(cls, dmap_data: List[dict], ax=None,
)? I personally feel it might be better to change the "calculated_fitted_velocities" function (
def calculated_fitted_velocities(cls, mlats: list, mlons: list,
) instead. Any thoughts/comments?

Copy link
Collaborator

@carleyjmartin carleyjmartin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, before we wrote this in pyDARN I basically did the same thing for our real-time display to print out the potential contours so I think it's good to return everything making up the plot by amending the plot_mapdata method rather than just the calculate_fitted_velocities method. Then the user can use the data to do whatever they want, as some of this data isn't give straight from the map file (I think that's what you mean in the comment above @bharatreddy as the calculate_fitted_velocities method just finds the velocities wrt the spherical harmonic functions and doesn't contain any other map data?)

I guess also should we consider renaming plot_mapdata? It was a hangover from the beginning of this file and I don't know if it's as user friendly as just plot_map? It's pretty normal or standard to return all the data used to plot the plot in a call to a plot, so it would be expected to return the data with it.

Anyway, I just saw a few things that I thought I should comment and now I've ran out of time so I'll do a proper test soon!

ret_dict['imf_info']['by'] = by
ret_dict['imf_info']['bz'] = bz
ret_dict['imf_info']['bt'] = bt
ret_dict['imf_info']['delay'] = delay

return mlats, mlons, v_mag
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not tested yet, just looking at the code. Should we return ret_dict here? And include the mlats, mlons and v_mag for the point on the map in the ret_dict too?

Comment on lines +409 to +410
ret_dict['fit_pot']['mlats'] = mlat_p
ret_dict['fit_pot']['mlons'] = mlon_p
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe keep these in the ret_dict with the '_p' so they don't get mixed up with the mlats and mlons from the vectors?

Comment on lines +405 to +408
mlat_p, mlon_p, pot_arr = cls.plot_potential_contours(fit_coefficient, lat_min, date, ax,
lat_shift=lat_shift, lon_shift=lon_shift,
fit_order=fit_order, hemisphere=hemisphere,
**kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flake8 info: These are >80 in length. PEP8 style to make sure the lines are 79 chars or less. I can do a proper flake8 sweep and amend things later if there might be some other changes.

@carleyjmartin
Copy link
Collaborator

I think #343 might help with this, is there any data that you want from any of the functions specifically? I think I got the array of potentials, hmb postion and the contours (along with the data) all in the return.

@carleyjmartin
Copy link
Collaborator

Let me know if #343 (now merged into develop and in the new release branch) addressed what you might need from the map plotting functions, I'm going to make this a draft for now so no one merges it by accident, if it is addressed we can close this PR!

@carleyjmartin carleyjmartin marked this pull request as draft November 28, 2023 15:26
@carleyjmartin carleyjmartin deleted the ehn/ret-map-data branch May 1, 2024 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants