MTgeophysics / mtpy

Python toolbox for standard Magnetotelluric (MT) data analysis
GNU General Public License v3.0
145 stars 66 forks source link

PT basemap #131

Open zachariahbkl opened 3 years ago

zachariahbkl commented 3 years ago

Dear All,

Please, I am not able to plot the color bar for my topographic basemap on PTmap (as attached below). My second question please, regarding the vector length that I must mention in the legend is it the same as the arrow size?

The last question please, is there a possibility to export a Georeferenced map?.

Looking forward to your answers.

Best regards, Zakaria. Figure_1

kashkoulimohammad commented 3 years ago

Hi @zachariahbkl, You can use the below attribute to change the color bar position.

cb_dict= {'orientation':'horizontal',
        'position': [0.45,0.0000001,0.26,0.035]}, # colorbar position [x,y,dx,dy]
zachariahbkl commented 3 years ago

Hi @zachariahbkl, You can use the below attribute to change the color bar position.

cb_dict= {'orientation':'horizontal',
      'position': [0.45,0.0000001,0.26,0.035]}, # colorbar position [x,y,dx,dy]

Thanks for you reply, but I'm asking how to display the basemap (topography) colorbar, not how to change the position!

kashkoulimohammad commented 3 years ago

Sorry for my wrong answer. Maybe you can use this: bimg_cmap default is viridis.

zachariahbkl commented 3 years ago

Sorry for my wrong answer. Maybe you can use this: bimg_cmap default is viridis.

This one is for choosing the color pallet

brenmous commented 3 years ago

Hi @zachariahbkl,

A colorbar for the basemap is not implemented. I currently don't have time to work on MTPy, but the relevant code is: plot_geotiff_on_axes function and where it gets called in the main PT plotting routine . If someone wants to attempt implementing this, here is an example of how I've implemented colorbars previously. The scalar mappable would be generated from the min/max of the geotiff basemap values and you would have to "steal" space for the colorbar ax by using make_axes_locatable on the main ax.

I'm unsure of the answer to your second question, do you mean is the length of the vector equivalent to the length of the arrow as it appears on the basemap? One of the MT scientists (@alkirkby) could be of more help.

For the third question, as far as I'm aware it's not possible to export a PT geotiff, but it is possible to export them as shapefiles using this script which you could then use in conjunction with other maps in your GIS software.

I hope this was of some help.

zachariahbkl commented 3 years ago

Hi @zachariahbkl,

A colorbar for the basemap is not implemented. I currently don't have time to work on MTPy, but the relevant code is: plot_geotiff_on_axes function and where it gets called in the main PT plotting routine . If someone wants to attempt implementing this, here is an example of how I've implemented colorbars previously. The scalar mappable would be generated from the min/max of the geotiff basemap values and you would have to "steal" space for the colorbar ax by using make_axes_locatable on the main ax.

I'm unsure of the answer to your second question, do you mean is the length of the vector equivalent to the length of the arrow as it appears on the basemap? One of the MT scientists (@alkirkby) could be of more help.

For the third question, as far as I'm aware it's not possible to export a PT geotiff, but it is possible to export them as shapefiles using this script which you could then use in conjunction with other maps in your GIS software.

I hope this was of some help.

Thank you very much for you reply.

Regarding the second question, I asking about the vector length that we usually mention on the vector's legend, (most of time it's 0.2 in the papers), I'm wondering if it's the same as the vector size (fixed in the script of MTPY).

I'll try to export it as shapefile, should be enough.

Much appreciated.

kujaku11 commented 3 years ago

@zachariahbkl The scale line should be equal to a tipper of 1. Looks like the label got commented out in the script. It might be that the arrow extends out of the map. You should be able to change the position of the tipper arrow scale bar with a key word of arrow_legend_position. Have a look at lines 1062-1141 in mtpy.imaging.phase_tensor_maps for more details.
For plotting with a basemap, I'd suggest exporting them to shape files and use a GIS program, then you'll have more control.

zachariahbkl commented 3 years ago

@zachariahbkl The scale line should be equal to a tipper of 1. Looks like the label got commented out in the script. It might be that the arrow extends out of the map. You should be able to change the position of the tipper arrow scale bar with a key word of arrow_legend_position. Have a look at lines 1062-1141 in mtpy.imaging.phase_tensor_maps for more details. For plotting with a basemap, I'd suggest exporting them to shape files and use a GIS program, then you'll have more control.

Thank you for your answer, but I'm not asking about the position of the tipper arrow, I want to know the value which must be mentioned in it !!? (Usually it's 0.2), so I'm wondering if it's the same as the vector size !!?

kujaku11 commented 3 years ago

@zachariahbkl The line is equal to a tipper magnitude of 1, that is what the label would have said had it not been commented out in the development branch. I suggested on checking the position in case it might looks small. If it does it could be that the line is extending outside the plot area.

zachariahbkl commented 3 years ago

@zachariahbkl The line is equal to a tipper magnitude of 1, that is what the label would have said had it not been commented out in the development branch. I suggested on checking the position in case it might looks small. If it does it could be that the line is extending outside the plot area.

Alright, thank you very much. Appreciate it.