I agree, Anna!


Nonetheless, this could be helpful (see the attached)

 
--
Best regards,
 
Maria V. Kozlova

  /------------------------------------\
  Information System Lab. (ISysLab)
  State Oceanographic Institute,
  Kropotkinsky per., 6,
  MOSCOW, 119034,
  RUSSIA
  ------------------------------------
  tel.    +7 499 246 6448
  fax.    +7 499 246 7288
  mailto:  k...@yandex.ru 
  \------------------------------------/
 
 
 
16.02.2016, 13:27, "anna zanchetta" <ciup...@gmail.com>:
 
Thanks Maria for your reply.
The system you used it's exactly the "tricky" one I was referring to: it solves the situation locally but the problem still remains.
 
Maybe some developer already started to put his hands on the code, otherwise I'd be really happy to try to do it myself, but I'm really a newbie so any tip/direction is welcome...
 
Anna
 
 
 
 
 


On Mon, Feb 8, 2016 at 9:25 AM, Kozlova Maria <k...@yandex.ru> wrote:
Dear Anna,
We solved such problems by writing python script for automated rename of files corresponded to ETM+ thermal bands before processing in Grass as we often have to work with many images.
in the case of single images it is not a problem to rename it to format LE........B61 and B62. Then after ETM+ data import to GRASS, i.landsat.toar work properly.

--
Best regards,

Maria V. Kozlova

  /------------------------------------\
  Information System Lab. (ISysLab)
  State Oceanographic Institute,
  Kropotkinsky per., 6,
  MOSCOW, 119034,
  RUSSIA
  ------------------------------------
  tel.    +7 499 246 6448
  fax.    +7 499 246 7288
  mailto:  k...@yandex.ru 
  \------------------------------------/


08.02.2016, 01:17, "anna zanchetta" <ciup...@gmail.com>:
> yes, i was referring to that.
> i think the problem is connected to the fact that i.landsat.toar works recursively on all bands
> which is what makes this command comfortable but in the same time it doesn't allow to calculate the TOAR for a specific band, in case one would like to do so
>
> thanks,
>
> Anna
>
> On Mon, Feb 8, 2016 at 12:00 AM, Markus Neteler <nete...@osgeo.org> wrote:
>> On Sun, Feb 7, 2016 at 9:48 PM, anna zanchetta <ciup...@gmail.com> wrote:
>>> hi grass users,
>>>
>>> i found a problem when running i.landsat.toar with Landsat 7,
>>> then i've eventually found in gis-stackexchange a "tricky" way to solve it:
>>> http://gis.stackexchange.com/questions/133053/i-landsat-toar-doesnt-work-with-band-6-of-landsat-7-in-grass-7
>>>
>>> i found it a bit clunky and thought to let you know in case someone wants to
>>> deal with this issue...
>>
>> So, you refer to "renaming LE70010752014040CUB00_B6_VCID_1 to
>> LE70010752014040CUB00_B61 do the trick." ?
>>
>> Indeed suboptimal. But I guess that pattern matching would make the
>> interface more complicated.
>> Maybe other developers have an idea?
>>
>> Best
>> Markus
>
> ,
>
> _______________________________________________
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
import os,re
from datetime import date
import glob, sys
import shutil

def remove_vcid(path):
    for root, subs, files in os.walk(path):
        for file in files:
            if re.compile(r'_VCID_').search(file):
                new_file = file.replace('_VCID_', '')
                print(file, ' >> ', new_file)
                shutil.copyfile(root + '\\' + file, root + '\\' + new_file)

if __name__ == '__main__':
    search_path = '.'

    if len(sys.argv) < 2:
        search_path = '.'
    elif (sys.argv[1]):
        search_path = sys.argv[1]

    remove_vcid(search_path)
    # print(sys.argv[1])
    input("PRESS ENTER TO CONTINUE.")
    pass



# DATE_FORMAT = '%Y-%b-%d'    # 1988-May-30
# FOLDER_FORMAT = '{0}_{1}'   # date_origin ex:(1988-May-30_etp172r26_5t19880530)

# PATERN = re.compile(r'^(\D{2}\d{1})(\d{6})(\d{4})(\d{3})(\D{3})(\d{2})$')
# PATERNS = [
#     # LT51720262013124KIS00
#     # LT5 172026 2013 124 KIS 00
#     re.compile(r'^(\D{2}\d{1})(\d{6})(\d{4})(\d{3})(\w{5})$'),
#     # etp172r26_5t19880530
#     # etp172r26_5t 1988 05 30
#     re.compile(r'^etp[^_]*_\d\D(\d{4})(\d{2})(\d{2})$')
# ]


# def get_date(year, day_of_year):
#     return date.fromordinal(date(year, 1, 1).toordinal() + day_of_year - 1).strftime(DATE_FORMAT)

# for folder in [name for name in os.listdir(".") if os.path.isdir(name)]:
#     match = PATERNS[0].search(folder)
#     if match:
#         prefix = get_date(int(match.group(3)), int(match.group(4)))
#         # print(FOLDER_FORMAT.format(prefix, folder))

#         try:
#             os.rename(folder, FOLDER_FORMAT.format(prefix, folder))
#         except:
#             print('Oops')

#         # prefix = date(int(match.group(1)), int(match.group(2)), int(match.group(3))).strftime(DATE_FORMAT)
#         # print(FOLDER_FORMAT.format(prefix, i))

#         pass
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to