ssec resources not loading

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
brianvh
Posts: 10
Joined: Mon Oct 08, 2018 12:14 pm

ssec resources not loading

Post by brianvh »

I used to run a jython script via runMcV that would download GOES satellite files. I can find and view these files when I run the McIdas GUI, but nothing happens when I try to do the same thing with the script (and it USED to work). Looking in the log file I see

"java.io.IOException: Could not load resource:/edu/wisc/ssec/mcidasv/resources/default.py"

and a number of similar warnings (not errors) with 'default.py' replaced by 'xxx.py'. Since this is a warning not an error I'm not sure if this is related to my file not being downloaded, but it's the only thing in both output and logfile that seems to indicate a problem. I can't find the directory /edu/wisc/ssec/ either on my computer or on the web. I'm using McIdas-V version 5.4.

I'm getting the same problem on two computers, which makes me suspect it may be a version problem.
If this problem doesn't look familiar to anyone, is there some other way I can get more diagnostics?

Thanks,

Brian
User avatar
bobc
Posts: 987
Joined: Mon Nov 15, 2010 5:57 pm

Re: ssec resources not loading

Post by bobc »

Hello,

There are WARN lines that print to mcidasv.log at startup related to default.py, radar.py, and prerelease. We have open inquiries to investigate the *.py warnings, but none of these should be the cause of any errors.

You mentioned that you are running McIDAS-V 5.4. Our last stable release is 1.8. If you start up McIDAS-V and from the Main Display window choose Help > About McIDAS-V you'll get an About McIDAS-V window which should include the McIDAS-V version. Could you please verify what this says?

You are correct that there is no /edu/wisc/ssec directory immediately visible to the user. This is a directory packaged inside of mcidasv.jar, which you should see in your McIDAS-V-System directory (or wherever McIDAS-V was installed). There should be no need for you unpackage the jar file though.

Are you only running your script from the background (e.g. runMcV.bat -script C:/Users/myuser/myscript.py) or from the Jython Shell in the foreground (Tools > Formulas > Jython Shell)? Generally any errors from a script will go to mcidasv.log, but it may be worth trying to run the script from the Jython Shell to see if you get an error there as well.

Would you mind posting your script for me to try on my end? Getting a chance to see the script would make this easier to debug. Also, you said that your script used to work. Did the script work in a previous version of McIDAS-V, then you upgraded your version, and then things broke? Or did the script work for a while in one version of McIDAS-V and suddenly break without any software updates?

Thanks,
Bob Carp
McIDAS User Services
User avatar
brianvh
Posts: 10
Joined: Mon Oct 08, 2018 12:14 pm

Re: ssec resources not loading

Post by brianvh »

wow, thanks for the quick response, Bob! Sorry about the version number, it's actually version 1.7. I have not upgraded between the last time I ran the code successfully and now.

The script below used to work when running on a linux system in background or on my mac using "runMcV -script G16_download.py" with appropriate paths added. Can't figure out how to run it from the Jython window.

Note I have a python file, and a separate text file for input. Both are shown below.

---
# G16_download(datafolder,year,month,day,starthr,endhr,startmin,endmin)
# (input is now via the goes_datetime.txt file)
"""
function to download goes16 data using mcidas-V
note that all data must be within the last 24 hours
All are except datafolder are expected to be integers
datafolder must end with '/'

run by 'runMcV -script goes16_download.py', but use full paths for runMcV, etc
/applications/McIDAS-V-System/

data is input by goes16_datetime.txt; look at read for format
"""

datafolder='/users/brianvanthull2/documents/grants/prathap/indoor/goes/'

# read date,time information from file
# if time = 0, most recent file is retrieved
f = open(datafolder+'goes16_datetime.txt','r')
dateline = f.readline()
f.close()
datearray = dateline.split(',')
year = (datearray[0]).strip()
month = (datearray[1]).strip()
day = (datearray[2]).strip()
starthr = (datearray[3]).strip()
endhr = (datearray[4]).strip()
startmin = (datearray[5]).strip()
endmin = (datearray[6]).strip()

# create date and time strings, assuming all inputs are integers
datestr = str(year)+'-'+str(month)+'-'+str(day)
starttime = str(starthr)+':'+str(startmin)+':00'
endtime = str(endhr)+':'+str(endmin)+':00'

print('start, end times:',starttime,endtime)
# make Python dictionary of parameters
g16Parms = dict(
server = 'lead.unidata.ucar.edu',
dataset = 'NPGOESR',
descriptor = 'CODCN',
day = datestr, # must be within one day of present
#short range of times to capture one image ('timestr1','timestr2')
time = (starttime,endtime),
unit = 'BRIT',
size = 'ALL'
)

# loadADDEImage call
g16Data = loadADDEImage(**g16Parms)

# Display the data returned from loadADDEImage in the currently active display panel
exportGridToNetcdf(g16Data,datafolder+'G16_download.nc')

---

Below is the contents of the goes_datetime.txt file:

2021, 06, 13, 12, 12, 00,03
User avatar
brianvh
Posts: 10
Joined: Mon Oct 08, 2018 12:14 pm

Re: ssec resources not loading

Post by brianvh »

Oops, just realized I was not following the note I made to myself in my own code: data must be from the last 24 hours!

So now it works on my mac, I just have to figure out what's going on with my linux. Perhaps I should delete this thread?
User avatar
bobc
Posts: 987
Joined: Mon Nov 15, 2010 5:57 pm

Re: ssec resources not loading

Post by bobc »

I'm glad you were able to figure out the problem on macOS. I was able to run your script on Windows 10, macOS, and Linux.

Have you tried looking at mcidasv.log (inside if your /home/username/McIDAS-V directory) to see if anything is being printed there using the correct date/time info when you run the script on Linux?

You should be able to run your script in the Jython Shell from a foreground session (by running: runMcV). From the Main Display window, select Tools>Formulas>Jython Shell. The Jython Shell defaults to single-line entry mode. To expand to multi-line mode, click the double-down blue arrow to the right of the text entry field. Copy your script, paste it into the Jython Shell, and click Evaluate. This process allowed me to run your script from the Jython Shell on Windows 10. You can find more info about the Jython Shell in the User's Guide.

No need to delete this thread! Other users may find your script useful and may have the same questions about the WARN lines going to mcidasv.log from default.py and radar.py.

Thanks,
Bob
Post Reply