Johannes Radinger wrote:

Doesn't work either with the -o flag:

r.unpack --o
input=/media/grassgis_data/tmp/tmp_Cele_raster_pack/my_raster.pack
output=my_raster
Traceback (most recent call last):
File "/usr/local/grass-7.0.1svn/scripts/r.unpack", line 146, in <module>
    sys.exit(main())
File "/usr/local/grass-7.0.1svn/scripts/r.unpack", line 104, in main
    proj=True):

Nikos Alexandris wrote:

Lines 115, 116 in r.unpack.py look a bit strange:

115  if flags['o']:
116      grass.warning(_("Projection information does not match.
Proceeding..."))

I mean, if the "-o" flag is instructed, which for line 115, means "True",
then issue the warning message.

The message seems to contradict the intention of using the flag here?
Maybe I don't get it right though.

So, why go into checking anything regarding PROJ_INFO or PROJ_UNITS if the "-o" flag is instructed? Completely untested, but maybe the script needs a modification (?), as follows:

# -----------------------------------------------------------------------
    if flags['o']:
grass.warning(_("Overriding projection check (using current location's projection)!"))

    else:

        diff_result_1 = diff_result_2 = None

        proj_info_file_1 = 'PROJ_INFO'
proj_info_file_2 = os.path.join(mset_dir, '..', 'PERMANENT', 'PROJ_INFO')

if not grass.compare_key_value_text_files(filename_a=proj_info_file_1, filename_b=proj_info_file_2,
                                                  proj=True):
diff_result_1 = diff_files(proj_info_file_1, proj_info_file_2)

        proj_units_file_1 = 'PROJ_UNITS'
proj_units_file_2 = os.path.join(mset_dir, '..', 'PERMANENT', 'PROJ_UNITS')

if not grass.compare_key_value_text_files(filename_a=proj_units_file_1, filename_b=proj_units_file_2,
                                                  units=True):
diff_result_2 = diff_files(proj_units_file_1, proj_units_file_2)

        if diff_result_1 or diff_result_2:

            if diff_result_1:
grass.warning(_("Difference between PROJ_INFO file of packed map " "and of current location:\n{diff}").format(diff=''.join(diff_result_1)))
            if diff_result_2:
grass.warning(_("Difference between PROJ_UNITS file of packed map " "and of current location:\n{diff}").format(diff=''.join(diff_result_2))) grass.fatal(_("Projection information does not match. Aborting.")) # -----------------------------------------------------------------------

Nikos
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to