[GRASS-dev] [GRASS GIS] #4016: i.modis.import Attribute Error

#4016: i.modis.import Attribute Error
---------------------------+-------------------------
Reporter: gabrieldeluca | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone:
Component: Addons | Version: unspecified
Keywords: | CPU: Unspecified
Platform: Linux |
---------------------------+-------------------------
Running GRASS GIS 7.8.2, in Ubuntu 18.04 (bionic).

I have installed `pymodis` library via `pip3` succesfully. Also, I have
installed `i.modis` add-on.

I have created an executable bash file, named `import_modis.sh`, to
download MODIS Land Surface Temperature products:

{{{
#!/bin/bash

i.modis.download settings=$HOME/settings \
  product=lst_terra_monthly_5600 \
  tile=h11v05 \
  startday=2015-01-01 endday=2017-12-31 \
  folder=/tmp
}}}

Where `settings` is the name of a text file in my home folder, with one
line for my user and one line for my password at earthexplorer site.

When I run: `grass78 /home/ga/grassdata/nc_basic_spm_grass7/modis_lst
--exec sh import_modis.sh`, it returns:

{{{
Starting GRASS GIS...
Cleaning up temporary files...
Executing <sh import_modis.sh> ...
WxPython missing, no GUI enabled
Traceback (most recent call last):
   File "/home/ga/.grass7/addons/scripts/i.modis.download", line 274, in
<module>
     sys.exit(main())
   File "/home/ga/.grass7/addons/scripts/i.modis.download", line 246, in
main
     prod = product(produ).returned()
   File "/home/ga/.grass7/addons/etc/i.modis/rmodislib.py", line 302, in
returned
     if self.products.keys().count(self.prod) == 1:
AttributeError: 'dict_keys' object has no attribute 'count'
Execution of <sh import_modis.sh> finished.
Cleaning up default sqlite database ...
Cleaning up temporary files...
}}}

I could not find information to help me solve if it is a problem in my
implementation. Nor did I find a similar previous report here.

Any detail or clarification that is necessary do not hesitate to ask me.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/4016&gt;
GRASS GIS <https://grass.osgeo.org>

#4016: i.modis.download Attribute Error
----------------------------+-------------------------
  Reporter: gabrieldeluca | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone:
Component: Addons | Version: unspecified
Resolution: | Keywords:
       CPU: Unspecified | Platform: Linux
----------------------------+-------------------------

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/4016#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#4016: i.modis.download Attribute Error
------------------------------+-------------------------
  Reporter: Gabriel De Luca | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone:
Component: Addons | Version: unspecified
Resolution: | Keywords:
       CPU: Unspecified | Platform: Linux
------------------------------+-------------------------

Comment (by lucadelu):

Hi Gabriel,

I'm sorry but I'm not able to reproduce your error. I copied your script
changing the enddate.

{{{
grass78 ~/grassdata/utm32N/lucadelu/ --exec sh /tmp/import_modis.sh
Starting GRASS GIS...
Cleaning up temporary files...
Executing <sh /tmp/import_modis.sh> ...
WARNING: GRASS GIS libgis version and date number not available
Downloading MODIS product <lst_terra_monthly_5600>...
All data have been downloaded, continue with i.modis.import with the
option
'files=/tmp/listfileMOD11B3.006.txt'
Execution of <sh /tmp/import_modis.sh> finished.
Cleaning up default sqlite database ...
Cleaning up temporary files...
lucadelu@geowork:~/github/grass$ cat /tmp/listfileMOD11B3.006.txt
MOD11B3.A2015001.h11v05.006.2016222155421.hdf
MOD11B3.A2015001.h11v05.006.2016222155421.hdf.xml
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/4016#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#4016: i.modis.download Attribute Error
------------------------------+-------------------------
  Reporter: Gabriel De Luca | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone:
Component: Addons | Version: unspecified
Resolution: | Keywords:
       CPU: Unspecified | Platform: Linux
------------------------------+-------------------------

Comment (by Gabriel De Luca):

Hi Luca,

Thanks for trying to reproduce it.

Something in my installation must be missing then, but I can't realize
what it is.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/4016#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#4016: i.modis.download Attribute Error
------------------------------+-------------------------
  Reporter: Gabriel De Luca | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone:
Component: Addons | Version: unspecified
Resolution: | Keywords:
       CPU: Unspecified | Platform: Linux
------------------------------+-------------------------

Comment (by lucadelu):

Hi Gabriel,

it seems that you have a old version of the addon.

Instead the line 302 now is

{{{
if list(self.products.keys()).count(self.prod) == 1:
}}}

instead your line seems to be

{{{
if self.products.keys().count(self.prod) == 1:
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/4016#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>

#4016: i.modis.download Attribute Error
------------------------------+-------------------------
  Reporter: Gabriel De Luca | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone:
Component: Addons | Version: unspecified
Resolution: | Keywords:
       CPU: Unspecified | Platform: Linux
------------------------------+-------------------------

Comment (by Gabriel De Luca):

Luca, thank you very much for your help.

Unfortunately I corrupted the GRASS installation in which I was
reproducing that project and I am no longer being able to reinstall it
correctly.

I think that closing this ticket would be the most convenient, since you
have seen that it was an outdated plugin problem.

If I could reproduce the problem in the future, I will likely to start a
new ticket on github or add a new comment here.

Thanks again.

Gabriel

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/4016#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>

#4016: i.modis.download Attribute Error
------------------------------+-------------------------
  Reporter: Gabriel De Luca | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone:
Component: Addons | Version: unspecified
Resolution: worksforme | Keywords:
       CPU: Unspecified | Platform: Linux
------------------------------+-------------------------
Changes (by lucadelu):

* status: new => closed
* resolution: => worksforme

Comment:

Please reopen if needed

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/4016#comment:6&gt;
GRASS GIS <https://grass.osgeo.org>