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

ipmag.vgpmag_magic erases 'normal' poles if there are reverse ones #649

Open
ltauxe opened this issue Apr 13, 2022 · 9 comments
Open

ipmag.vgpmag_magic erases 'normal' poles if there are reverse ones #649

ltauxe opened this issue Apr 13, 2022 · 9 comments
Assignees

Comments

@ltauxe
Copy link
Member

ltauxe commented Apr 13, 2022

What command was run:

ipmag.vgpmap_magic(dir_path=dir_path,size=50,flip=True,save_plots=True,lat_0=60,rsym='b^',rsize=50,fmt='png')

and

ipmag.vgpmap_magic(dir_path=dir_path,size=50,flip=False,save_plots=True,lat_0=60,rsym='b^',rsize=50,fmt='png')

What happened:

There are no 'normal' poles when flip is set to True. This used to work but something happened!

What I expected to happen:

I expect the red and blue symbols as advertized for when flip is set to True

Data file(s):
sites.txt

Screenshot(s):
plot with both normal and reverse data only shows only reverse poles:

Golan-Heights_VGP_map

without flip, you get only the normal poles (as expected).

Golan-Heights_VGP_map

The way it is supposed to work (and does on jupyterhub.earthref.org, weirdly, with the same version of PmagPy).

Screen Shot 2022-04-13 at 1 36 38 PM

PmagPy version:
pmagpy-4.2.98

@Swanson-Hysell
Copy link
Member

It looks like the code is first plotting the normal:

    if len(lats) > 0:
        # add the lats and lons of the poles
        pmagplotlib.plot_map(FIG['map'], lats, lons, Opts)

and then plotting the reversed:

    if len(rlats) > 0:
        Opts['sym'] = rsym
        Opts['symsize'] = rsize
        # add the lats and lons of the poles
        pmagplotlib.plot_map(FIG['map'], rlats, rlons, Opts)

What might be happening is that the land and ocean in the second pmagplotlib.plot_map() is covering up the first set of points.

@ltauxe
Copy link
Member Author

ltauxe commented Apr 13, 2022 via email

@ltauxe
Copy link
Member Author

ltauxe commented Apr 13, 2022 via email

@Swanson-Hysell
Copy link
Member

An inelegant solution that works is where:

    if len(rlats) > 0:
        Opts['sym'] = rsym
        Opts['symsize'] = rsize
        # add the lats and lons of the poles
        pmagplotlib.plot_map(FIG['map'], rlats, rlons, Opts)

is replaced with:

    if len(rlats) > 0:
        Opts['sym'] = rsym
        Opts['symsize'] = rsize
        if len(lats) > 0:
            color, symbol = Opts['sym'][0], Opts['sym'][1]
            plt.gca().scatter(rlons, rlats, s=Opts['symsize'], c=color, marker=symbol,
                              transform=ccrs.PlateCarree(), edgecolors=Opts['edgecolor'])
        else:
            pmagplotlib.plot_map(FIG['map'], rlats, rlons, Opts)

@Swanson-Hysell
Copy link
Member

That solution just plots with scatter on the already generated axis and gives:
Screen Shot 2022-04-13 at 2 26 30 PM

@Swanson-Hysell
Copy link
Member

yeah but the flag ‘pltgrid’ in Opts is turned off, so it isn’t supposed to do that. I tried a bunch of things and couldn’t get it to work…. lisa

I think it is the plotting of the oceans and land rather than the grid that is hiding the normal points when the reversed map is generated with pmagplotlib.plot_map().

It is likely preferable to be using the map that is already generated rather than making a whole new map (which is what the edited code above does). I can commit that if it looks ok to you.

@ltauxe
Copy link
Member Author

ltauxe commented Apr 13, 2022 via email

@Swanson-Hysell
Copy link
Member

Did commit e2a7b00 solve the issue? If so, we can go ahead and close.

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

No branches or pull requests

2 participants