vtsuperdarn / davitpy

DEPRECATED The DaViT Python project
http://vtsuperdarn.github.com/davitpy/
GNU General Public License v3.0
37 stars 59 forks source link

Bugfix: Updating Tsyganenko to support numpy>=1.12.0 #358

Closed asreimer closed 4 years ago

asreimer commented 6 years ago

Updating code to fix syntax errors caused by changes to numpy after version 1.12.0.

Initial bug reported by @RichardoC in #331. Additional bug found involving non-integer indicies being deprecated in numpy.

To test the code:

from numpy import arange, zeros, ones
from davitpy.models import tsyganenko

lats = arange(10, 90, 10)
lons = zeros(len(lats))
rhos = 6372.*ones(len(lats))
trace = tsyganenko.tsygTrace(lats, lons, rhos)
johncoxon commented 6 years ago

Only just saw this. Why has this not been pulled into the master branch yet?

asreimer commented 6 years ago

Hey @johncoxon. Likely because we are all volunteers and no one is being paid to work on this. Also, most of us were at the SuperDARN workshop, which as you must know requires a huge amount of time to prepare for, travel, attend, and travel again.

Appreciate the ping and the edit to make your comment friendlier. Maybe we can start getting some development going here again now that we're all back and getting caught up in our personal/work lives.

johncoxon commented 6 years ago

Hey! I didn't mean for the original comment to seem unfriendly – I was just feeling dumb because I should have looked at the pull requests before writing my own fix. Thanks for the hard work, I know I'm not the only one that really appreciates it.

aburrell commented 6 years ago

I got this error trying to import the module:

ERROR:root:davitpy/models/init.pyc -> models.tsyganenko: invalid syntax (init.py, line 131) Traceback (most recent call last): File "davitpy/models/init.py", line 22, in import tsyganenko File "davitpy/models/tsyganenko/init.py", line 131 advice = 'You must provide either (lat, lon, rho) or a ' + ^ SyntaxError: invalid syntax

asreimer commented 6 years ago

That should have fixed it. Forgot the brackets.

aburrell commented 6 years ago

Ok, I found the other missing bracket. This is what I get for the output now:

vswgse=[ -400, 0, 0] [m/s] pdyn= 2 [nPa] dst= -5 [nT] byimf= 0 [nT] bzimf= -5 [nT]

Coords: geo (latitude [degrees], longitude [degrees], distance from center of the Earth [km])

(10.000, 0.000, 6372.000) @ 17:40 UT (14-Jun-18) --> NH(13.629, 359.856, 6371.128) --> SH( 9.925, 0.003, 6371.164)

(20.000, 0.000, 6372.000) @ 17:40 UT (14-Jun-18) --> NH(20.019, 360.000, 6371.191) --> SH( 3.283, 0.736, 6371.132)

(30.000, 0.000, 6372.000) @ 17:40 UT (14-Jun-18) --> NH(30.008, 360.000, 6371.197) --> SH(-8.053, 2.497, 6371.168)

(40.000, 0.000, 6372.000) @ 17:40 UT (14-Jun-18) --> NH(40.005, 360.000, 6371.198) --> SH(-21.699, 6.437, 6371.192)

(50.000, 0.000, 6372.000) @ 17:40 UT (14-Jun-18) --> NH(50.003, 360.000, 6371.199) --> SH(-39.333, 15.070, 6371.197)

(60.000, 0.000, 6372.000) @ 17:40 UT (14-Jun-18) --> NH(60.002, 360.000, 6371.200) --> SH(-56.447, 31.839, 6371.192)

(70.000, 0.000, 6372.000) @ 17:40 UT (14-Jun-18) --> NH(70.001, 360.000, 6371.200) --> SH(-63.042, 66.365, 6371.196)

(80.000, 0.000, 6372.000) @ 17:40 UT (14-Jun-18) --> NH(80.001, 360.000, 6371.201) --> SH(-8.045, 69.837, 274186.949)

ksterne commented 4 years ago

@aburrell @johncoxon, this might be a shot in the dark, but wondering if this was good enough to merge in? It looks like @aburrell was able to run a test successfully. If not completely sure or easy to tell, then not a problem. I'll close it since this repo is being deprecated.

aburrell commented 4 years ago

I think it's good enough to merge.

ksterne commented 4 years ago

Thanks for the quick response @aburrell. I'll merge it in now.