Skip to content

ModelField Segfaults for Some Calls #26

Description

@ddasilva

Hi Matt,

I've been using this library for a number of years and it's great. I recently released my own package rbinvariantslib, which uses PyGeopack.

Recently I started getting segfaults for calls which I think should be simple and (if I'm not crazy) worked before. This snippet below makes a regular grid of spacing 0.1 in xyz between -10 and 10, and evalutes TS05 on it. It segfaults at the last call. Unusually, when the grid spacing is 0.5, it does not segfault.

Can you take a look? If there's any workaround before the bug is fixed please let me know.

Best,
Daniel

import os

# Don't print warnings from pygeopack about data not found
os.environ['GEOPACK_NOWARN'] = '1'
import PyGeopack as gp

from rbinvariantslib import models, invariants
from datetime import datetime
import numpy as np

# Setup time
time = datetime(2015, 10, 2)
gp_date = int(time.strftime("%Y%m%d"))
gp_ut = int(time.strftime("%H")) + time.minute / 60

# Setup params
params = {'Pdyn': 2.609999974394062, 'SymH': -14.0, 'By': 10.9399995803833, 'Bz': 1.7699999809265137, 'W1': 0.0, 'W2': 0.0, 'W3': 0.0, 'W4': 0.0, 'W5': 0.0, 'W6': 0.0}

# Setup x, y, z inputs
axis = np.arange(-10, 10, 0.1)
x, y, z = np.meshgrid(axis, axis, axis)
x = x.flatten()
y = y.flatten()
z = z.flatten()

# Make call (this segfaults)
Bx, By, Bz = gp.ModelField(
     x,
     y,
     z,
     Date=gp_date,
     ut=gp_ut,
     Model='TS05',
     CoordIn='SM',
     CoordOut='SM',
     **params
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions