Map viz #122
Replies: 7 comments
-
Hi @andresp-wave, I think that would be a good contribution! I don't have an issue with taking pygmt as an optional dependency, especially now that it is available on conda-forge. You can use the Probably start by creating a new module (python file) in the viz directory. The tests for the function should then go in the tests/test_viz directory. When running visualization tests, we generally don't show the image but just ensure the code will run. Probably the best visualization example to look at is The developer docs should be helpful (let me know if you find any parts confusing). I am also happy to help. |
Beta Was this translation helpful? Give feedback.
-
Hey, I am Fu, a Rice student who worked with Jonathan, recently created a tiny package for DAS geometry using gps interpolation, and I have successfully tested it in some cases. I think it can also be used for the dascore. The main features are:
But one downside is that you need a token of Mapbox, and if you use it for more than a limited time, it will charge your money. For this I bind the credit card, so the token cannot be shared. And Jonathan told me Mapbox has an academic version, so maybe is possible to implement it in dascore. There are some examples: |
Beta Was this translation helpful? Give feedback.
-
I am looking for a possible implementation for the |
Beta Was this translation helpful? Give feedback.
-
And I think |
Beta Was this translation helpful? Give feedback.
-
The following is a demo showing how to use this tiny package. # %% 2.
import plot_map
import das_interp
import numpy as np
points = np.loadtxt('known_points.txt') # 2-d np.array: Latitude, Longitude, Altitude, Channel
spacing_interval = 2.45 # unit: m
channel_start = -10
channel_end = 104
results, known_index = das_interp.interp(points,
channel_start,
channel_end,
spacing_interval)
np.savetxt('results.txt', results, fmt='%.7f')
plot_map.set_mapboxtoken('xxxxxxx')
plot_map.set_imgsavepath('./')
das_interp.plot(points,
results,
known_index,
# subplot
plot_ax_right_flag=True,
ax_right_size=0.7,
plot_ax_top_flag=True,
ax_top_size=0.7,
# map
plot_map_flag=True,
map_style=3, # 3
compasssize=2,
compass_accuracy=2,
compass_textsize=4,
compass_unit='m',
rect=[0.12,0.05], # [left, bottom]
# colorbar
colorbar_size=0.2,
colorbar_ticks_labelsize=6,
colorbar_label_fontsize=8,
# legend
legend_fontsize=6,
# save
save_flag=True,
save_path='./interp_map.pdf',
# plot sag
plot_sag_flag=True,
sag_linewidth=6,
sag_cmap=plt.colormaps["bwr"],
# plot results line
plot_results_line_flag=True,
results_linewidth=1,
results_line_color='gray',
# plot results dot
plot_results_dot_flag=True,
results_markersize=1,
results_dot_color='orange',
# plot results label
plot_results_label_flag=True,
results_label_gap=10,
# plot points dot
plot_points_dot_flag=True,
points_markersize=3,
points_dot_color='k',
# plot points label
plot_points_label_flag=True,
points_label_gap=5,
# fontsize of results and points label
results_points_label_fontsize=6,
# fontsize of ticks and axis label for all subplots
ticks_labelsize=6,
axis_label_fontsize=8,
# ticks format for all subplots
ticks_format_latlon='%0.4f', # '%0.4f'
ticks_format_altitude='%0.1f', # '%0.1f'
# ticks number for all subplots
ticks_lon_num=5,
ticks_lat_num=5,
ticks_altitude_num=3,
# ticks rotation for all subplots
ticks_lon_rotation=30,
ticks_lat_rotation=0,
ticks_altitude_rotation=0,
) |
Beta Was this translation helpful? Give feedback.
-
Hey @OUCyf, Nice work on the plots, they look good and seem to be simple to create. The level of detail and style options are impressive. Two thoughts here:
|
Beta Was this translation helpful? Give feedback.
-
Yeah, I agree with your points, a package should have very limited dependencies. And interpolation logic could be useful to DASCore, and it can be added in. As for details of the |
Beta Was this translation helpful? Give feedback.
-
Hello dascore members !
I am Andres and relatively new to DAS. I would like to contribute when possible with code or comments to the DAScore project ! At the moment, I am working in a code to do a quick map for any given patch if it has latitude and longitude (Similar to what inventory.plot() does in Obspy). It is quite preliminary (and it also requires pygmt) + I know there are already some issues with the units. Any suggestions/comments are welcome. I will try to upload the code this week once I clean it more and fix an issue I have with github in my terminal.
best,
Andres Pena
Beta Was this translation helpful? Give feedback.
All reactions