I CAN’T DOWNLOAD IMAGE DATA WITH FEDORA 35

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
gdmontoyag
Posts: 5
Joined: Thu May 12, 2016 4:50 pm

I CAN’T DOWNLOAD IMAGE DATA WITH FEDORA 35

Post by gdmontoyag »

Dear McIDAS-V Support Forums,
When a run the annexed jython script (see annex), in order to download image data, no data is written in the output files and the following warning appears in the Mcidasv.log
“WARN ucar.unidata.util.LogUtil - log: Local servers cannot write to userpath: /root/McIDAS-V”
I have installed fedora 35 in my laptop. Also I installed, McIDAS-V_1.8_linux_86-64_installer.sh, in the directory /root/McIDAS-V-System/
Following the reply (by Rick » Thu Oct 02, 2014 6:14 pm ) to the post: viewtopic.php?f=14&t=1501 , when I run the command:
[root@fedora bin]# ./mcservl
The output is:
./mcservl: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory
the contents of my root/McIDAS-V-System/adde/bin/ is:
abinadir areaadir indiaget lwprserv modraget omtpaget
abinaget areaaget indsadir mcserv modsadir poesadir
adirserv atokserv indsaget mcservl modsaget poesaget
agetserv awipadir instadir mdfhserv modxadir sminadir
airsadir awipaget instaget mdhdserv modxaget sminaget
airsaget fsdxadir libgfortran.so.1 mdksserv msgtadir tminadir
amrradir fsdxaget libhdf5_hl.so.8 mdroserv msgtaget tminaget
amrraget giniadir libhdf5.so.8 mod4adir msgxadir txtgserv
amseadir giniaget libnetcdf.so.7 mod4aget msgxaget vpserv
amseaget gvaradir libpng15.so.15 mod8adir mtstadir wariadir
amsradir gvaraget lv1badir mod8aget mtstaget wariaget
amsraget indiadir lv1baget modradir omtpadir
As you can see, this directory does not content the library, libgfortran.so.3
Thus, I did the following actions: 1). I copy this archive from an earlier version of Fedora, to the dir: root/McIDAS-V-System/adde/bin/ and 2). I run the commands:
[root@fedora bin]# export LD_LIBRARY_PATH=.
[root@fedora bin]# ./mcservl
The result was:
DIR= /root/McIDAS-V-System/adde/bin
McIDAS interactive ADDE server
Remote connections blocked
PORT= 8112
PATH= /root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/lib/snapd/snap/bin
MCPATH= (null)
Waiting for connections…
I also tried to open the port 8112 with:
[root@fedora /]# sudo firewall-cmd –add-port=8112/udp
The answer was:
Warning: ALREADY_ENABLED: '8112:udp' already in 'FedoraWorkstation'
Success
This action also didn’t solve the problem of downloading satellite data and I don’t know how to overcome it.
Any help will be appreciated.
Attachments
IrGoes16_V0.py
(3.64 KiB) Downloaded 52 times
User avatar
bobc
Posts: 987
Joined: Mon Nov 15, 2010 5:57 pm

Re: I CAN’T DOWNLOAD IMAGE DATA WITH FEDORA 35

Post by bobc »

Hello,

I believe the reason you're seeing the errors from mcservl (the local server process) is that you have McIDAS-V installed in the /root directory. We recommend that users install in their own user directory (as their own user, not an admin) so that there are no read/write permissions. However, your script is only loading remote data, so local servers shouldn't be necessary. There were several minor issues with your script that prevented it from running along with a more major change for the way the user specifies the position. Here's a list of those minor changes I made:
  1. I created some directories on my machine (C:/Users/rcarp/McV_Forum and two directories in there including "IrGoes16" and "TempIr"). I changed the DataPath and ImagePath directories to point at the directories I created on my machine. I suggest you make sure you're writing to directories on your machine you have full permissions to.
  2. For the "fehora" string, I found problems including a colon (:) in the filename, so I removed the colon from that string. Your script included:

    Code: Select all

    fehora = a[0:10]+"_"+a[11:16]
    
    Which outputs a string like "2022-06-02_15:50". I changed this line to:

    Code: Select all

    fehora = a[0:10]+"_"+a[11:16].replace(':','')
    
    This outputs a string like "2022-06-02_1550".
  3. In your captureImage line, EndName wasn't quite specified correctly. The script wanted to create a directory of the fehora variable and an image called "*.jpg". I fixed this in the following way. Your script included:

    Code: Select all

    #plot the image
    EndName=os.path.join(Dirima,fehora,'.jpg')
    panel[0].captureImage(EndName)
    
    I changed this to:

    Code: Select all

    #plot the image
    imgName = '%s.jpg' % fehora
    EndName=os.path.join(Dirima,imgName)
    panel[0].captureImage(EndName)
    
  4. Your exportGridToNetcdf command was passing through 3 variables, when it should be two. Strings can be added together in Python, which is what I did to fix this line. Your script included:

    Code: Select all

    exportGridToNetcdf(irData,dataDir,fnameIr)
    
    I changed this to:

    Code: Select all

    exportGridToNetcdf(irData,dataDir+fnameIr)
    
  5. The last minor changed I made were to your framelat and framelon lines. You need quotes around the values so the script knows they're strings. Your script included:

    Code: Select all

    fnamelat = ir_lat.nc
    ...
    fnamelon = ir_lon.nc
    
    I changed these lines to:

    Code: Select all

    fnamelat = 'ir_lat.nc'
    ...
    fnamelon = 'ir_lon.nc'
    
The only relatively major change I made was to the way you are specifying the position. Instead of having the user manually specify the position during the evaluation of the script, I would suggest that you use the "scriptargs" flag. The scriptargs flag assumes the script is set up to accept arguments using standard Python optparse/argparse syntax. At least on my Windows 10 machine, using your "input" line caused the script to hang as the Command Prompt window never asked me to specify a position number. Here's my process on using scriptargs with optparse in the script (you could substitute in argparse):
  1. I added some lines near the beginning of the script to specify the argument we want to specify at the start of the script (tiemp):

    Code: Select all

    from optparse import OptionParser
    parser=OptionParser()
    parser.add_option('-t', '--tiemp', action='store', dest='tiemp', type=str, help='Position')
    (options, args) = parser.parse_args()
    
  2. Since I'm asking the user to specify the position at startup, there's no need to ask for it in the script. I removed the following lines from your script:

    Code: Select all

    #enter position: 0 for the last image or negative value for other
    print("Enter position")
    tiemp = input("Enter position: ")
    
  3. With scriptargs, we need to change the way that the "tiemp" variable is passed through the ADDE commands. Your script included:

    Code: Select all

    dirList = listADDEImages(position =tiemp,**listParms)
    ...
    irData = loadADDEImage(position =tiemp,**loadParms)
    
    I changed this to:

    Code: Select all

    dirList = listADDEImages(position =options.tiemp,**listParms)
    ...
    irData = loadADDEImage(position =options.tiemp,**loadParms)
    
  4. To run the script from the background, I ran the following command to get position "-1". You'll need to change the path to point at your script. You should also use "runMcV' on Unix instead of "runMcV.bat" which is for Windows:

    Code: Select all

    runMcV.bat -script C:/Users/rcarp/IrGoes16_V0_updated.py -scriptargs --tiemp -1
    This script saved an image file (2022-06-02_1550.jpg), Cualquiercosa.txt, ir_lat.nc, ir_lon.nc, and TempIrir.nc. I'm attaching my updated version of the script.
Here are a couple suggestions when you're having trouble with a script:
  1. When first writing a script, I like to run it in the foreground through the Jython Shell. Here, you can see the progress of the script as it goes (e.g. the build of the window and display of the data), and you'll get errors printed out to the Shell. You can iterate through these errors in the Shell without having to run the entire script every time.
  2. If you want to run only from the background, I suggest looking at mcidasv.log which is in your McIDAS-V directory (typically in /home/username/McIDAS-V). The log file will include any error messages, which should help point to where the problem area in your script is.
Please let me know if you have any further questions on this topic.

Thanks,
Bob Carp
McIDAS User Services
Attachments
IrGoes16_V0_updated.py
(3.77 KiB) Downloaded 54 times
Post Reply