vtsuperdarn / davitpy

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

getRadarByCode() fails when unable to connect to DB #369

Closed kkotyk closed 4 years ago

kkotyk commented 5 years ago

Here is my traceback

ERROR:root:Could not connect to remote DB: mongodb://sd_dbread:5d@sd-work9.ece.vt.edu:27017/radarInfo WARNING:root:Reading hdw.dat info from local files in /home/rst3/rst/tables/superdarn/hdw/ ERROR:root:sqlInit() Error unable to open database file: /tmp/sd/.radars.sqlite Traceback (most recent call last): File "/home/kotyk/davitpyenv/lib/python2.7/site-packages/davitpy-0.8-py2.7-linux-x86_64.egg/davitpy/pydarn/radar/radInfoIo.py", line 372, in sqlInit with lite.connect(fname) as conn: OperationalError: unable to open database file ERROR:root:/tmp/sd/.radars.sqlite not found Traceback (most recent call last): File "create_geojson_fov.py", line 54, in main() File "create_geojson_fov.py", line 35, in main radId = pydarn.radar.network().getRadarByCode(radar).id File "/home/kotyk/davitpyenv/lib/python2.7/site-packages/davitpy-0.8-py2.7-linux-x86_64.egg/davitpy/pydarn/radar/radStruct.py", line 234, in getRadarByCode radar = self.getRadarBy(code, by='code') File "/home/kotyk/davitpyenv/lib/python2.7/site-packages/davitpy-0.8-py2.7-linux-x86_64.egg/davitpy/pydarn/radar/radStruct.py", line 261, in getRadarBy for irad in xrange(self.nradar): AttributeError: 'network' object has no attribute 'nradar'

From the code it looks like 'nradar' is only populated on a successful connect to the DB which I believe is down for the foreseeable future?

kkotyk commented 5 years ago

EDIT: I have the SD env variables set as well.

ksterne commented 5 years ago

Hey @kkotyk, I see the mongodb process is still running on our machine. So I don't think that's the issue. Send over your IP address (by e-mail if you want discretion) and I can see if it's been added to our deny hosts list. That's usually the problem here.

MANTSIBANA commented 4 years ago

Hi ,I am also getting the same error as kkotyk

ksterne commented 4 years ago

@kkotyk, I guess we never closed this. I think I got you squared away though right? @MANTSIBANA, can you post the error that you are getting here?

MANTSIBANA commented 4 years ago

@ksterne , after setting my environment variables SD_RADAR (to point to the radar.dat file) and SD_HDWPATH (to point to the directory where the hdw.dat files are present).

I am getting the following error :

ERROR:root:Could not connect to remote DB: mongodb://sd_dbread:5d@sd-work9.ece.vt.edu:27017/radarInfo WARNING:root:Reading hdw.dat info from local files in /home/workstation/Downloads/hdw.dat-master/

ksterne commented 4 years ago

@MANTSIBANA, yes, this seems like your IP address has been blocked on our system. Can you send over your IP address and I can check to see if it is blocked here?

MANTSIBANA commented 4 years ago

@ksterne , IP : .

I checked if i have access to port 27017 and it succeeds : Connection to sd-work9.ece.vt.edu 27017 port [tcp/*] succeeded!

ksterne commented 4 years ago

Sounds good on getting a connection, the server isn't blocking you then. You might need to run the radar update manually by making a short script/code that includes: obj = davitpy.pydarn.radar.updateRadars() as mentioned in #339. Also check permissions to see that you can write to the directory its trying to make the file in.

Also note from #372, this repo is being deprecated very soon. It might be better if you started using the replacement for this repo found at: https://github.com/SuperDARN/pydarn

MANTSIBANA commented 4 years ago

I am new to this and I do not have an idea on how to go about running the radar update manually by obj = davitpy.pydarn.radar.updateRadars() , please assist.

ksterne commented 4 years ago

In addition to other parts of deprecated the davitpy repo, should be noted that the mongodb access to sd-work9 had to be closed. The solution is to acquire hdw.dat files from either the hdw.dat repo or the rst repo (comes with much more than hdw.dat files) and update from the local files.