Created
December 18, 2019 00:27
-
-
Save josuemtzmo/c644d1619f5120b2d87cf2e63fd70c65 to your computer and use it in GitHub Desktop.
Code to generate regional boxes in maps with Basemap. It can be implemented in carroty by replacing the map function with the corresponding one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pacific,Indian, Atlantic | |
# Values correspond to the corners of the box. | |
x_areas=[[150,150,288,288],[40,40,150,150],[325-360,325-360,10,10]] | |
y_areas=[[-48,-62,-62,-48],[-44,-57,-57,-44],[-46,-56,-56,-46]] | |
for a_ind in range(len(x_areas)): | |
#Initial position of box | |
A_x=[x_areas[a_ind][0]] | |
A_y=[y_areas[a_ind][0]] | |
#Append each degree a new point in the x and y direction. | |
[A_x.append(ii) for ii in arange(x_areas[a_ind][1],x_areas[a_ind][2]+1)] | |
[A_y.append(y_areas[a_ind][1]) for ii in arange(x_areas[a_ind][1],x_areas[a_ind][2]+1)] | |
[A_x.append(ii) for ii in flipud(arange(x_areas[a_ind][1],x_areas[a_ind][2]+1))] | |
[A_y.append(y_areas[a_ind][-1]) for ii in arange(x_areas[a_ind][1],x_areas[a_ind][2]+1)] | |
#Plot corresponding lines. | |
A_xm,A_ym=map(array(A_x),array(A_y)) | |
map.plot(A_xm,A_ym,'--',linewidth=2, color='gold') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment