From 8debc3b58748ee40f88e62ff99acacd55dcee4d3 Mon Sep 17 00:00:00 2001 From: zhang01GA Date: Fri, 3 May 2019 09:55:55 +1000 Subject: [PATCH] reverse array to make the geotiff image right onto map --- mtpy/utils/convert_modem_data_to_geogrid.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mtpy/utils/convert_modem_data_to_geogrid.py b/mtpy/utils/convert_modem_data_to_geogrid.py index 8e9b4bf71..9a1d0083a 100644 --- a/mtpy/utils/convert_modem_data_to_geogrid.py +++ b/mtpy/utils/convert_modem_data_to_geogrid.py @@ -114,9 +114,6 @@ def modem2geotiff(data_file, model_file, output_file, source_proj=None): # result['latitude'], result['longitude'], result['depth'], # result['resistivity'], z_label='depth') - # test_array2geotiff_writer(output_file) - - print("result['latitude'] ==", result['latitude']) print("result['longitude'] ==", result['longitude']) print("result['depth'] ==", result['depth']) @@ -127,7 +124,9 @@ def modem2geotiff(data_file, model_file, output_file, source_proj=None): # write the depth_index depth_index=1 - array2geotiff_writer(output_file,origin,pixel_width,pixel_height,result['resistivity'][depth_index,:,:]) + resis_data = result['resistivity'][depth_index,:,:] + resis_data2 = resis_data[::-1] # flipped upside down to get geotiff mapped correctly. + array2geotiff_writer(output_file,origin,pixel_width,pixel_height,resis_data2) return output_file @@ -146,3 +145,6 @@ def modem2geotiff(data_file, model_file, output_file, source_proj=None): args = parser.parse_args() modem2geotiff(args.modem_data, args.modem_model, args.output_file, args.epsg) + + + test_array2geotiff_writer("test_geotiff_GDAL_img.tif")