Skip to content

Commit f4506ec

Browse files
author
cicuser
committed
#4 imported the codes from kml
1 parent 2ed8d3b commit f4506ec

File tree

1 file changed

+37
-10
lines changed

1 file changed

+37
-10
lines changed

getDisplacement/getDisplacement.ipynb

+37-10
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,43 @@
8383
" icon_url = \"https://maps.google.com/mapfiles/kml/paddle/grn-blank.png\"\n",
8484
" html = '<a target=\"_blank\" href=\"https://sideshow.jpl.nasa.gov/post/links/{site}.html\"><img src=\"https://sideshow.jpl.nasa.gov/post/plots/{site}.jpg\" width=\"300\" height=\"300\"></a>'\n",
8585
" for cord, disp, site in zip(zip(df[lat_col], df[lon_col]), df[data_col], df[site_col]):\n",
86-
" folium.Circle(\n",
87-
" location=cord,\n",
88-
" radius=abs(disp)*scale,\n",
86+
" theta = 0\n",
87+
" coords = []\n",
88+
" for k in range(0,31):\n",
89+
" vrad = disp\n",
90+
" lat = cord[0]\n",
91+
" lon = cord[1]\n",
92+
" angle = k/30*2*math.pi\n",
93+
" elon = vrad*math.cos(angle)*math.cos(theta)-vrad*math.sin(angle)*math.sin(theta)\n",
94+
" elat = vrad*math.cos(angle)*math.sin(theta)+vrad*math.sin(angle)*math.cos(theta)\n",
95+
" elon = (elon+0)/scale/math.cos(lat*math.pi/180.)\n",
96+
" elat = (elat+0)/scale\n",
97+
" coords.append([lat + elat,lon + elon])\n",
98+
" if (disp > 0):\n",
99+
" lcolor = 'red'\n",
100+
" else:\n",
101+
" lcolor = 'blue'\n",
102+
" folium.Polygon(\n",
103+
" locations=coords,\n",
104+
" fillColor=lcolor,\n",
89105
" fill=True,\n",
90-
" color=colormap(disp),\n",
106+
" fillOpacity=0.9,\n",
107+
" color=lcolor,\n",
108+
" weight=2,\n",
91109
" popup=f'Vertical Displacement:{\"{:10.4f}\".format(disp)} mm, Site:{site}',\n",
92-
" stroke=True,\n",
93-
" weight=1,\n",
94-
" fill_opacity=.8\n",
95-
" ).add_to(vertical)\n",
110+
" ).add_to(vertical)\n",
111+
"# folium.Circle(\n",
112+
"# location=cord,\n",
113+
"# radius=abs(disp)*scale,\n",
114+
"# fill=True,\n",
115+
"# color=colormap(disp),\n",
116+
"# popup=f'Vertical Displacement:{\"{:10.4f}\".format(disp)} mm, Site:{site}',\n",
117+
"# stroke=True,\n",
118+
"# weight=1,\n",
119+
"# fill_opacity=.8\n",
120+
"# ).add_to(vertical)\n",
121+
" \n",
122+
" \n",
96123
" icon = folium.features.CustomIcon(icon_url,icon_size=(16, 16),icon_anchor=(8,16))\n",
97124
" #iframe = folium.element.IFrame(html=html, width=500, height=300)\n",
98125
" s_html = html.format(site=site)\n",
@@ -342,7 +369,7 @@
342369
{
343370
"data": {
344371
"application/vnd.jupyter.widget-view+json": {
345-
"model_id": "72fbff5266044cc5819c63cf92614446",
372+
"model_id": "8254138517d549418c2db180ac830fa1",
346373
"version_major": 2,
347374
"version_minor": 0
348375
},
@@ -447,7 +474,7 @@
447474
"name": "python",
448475
"nbconvert_exporter": "python",
449476
"pygments_lexer": "ipython3",
450-
"version": "3.9.2"
477+
"version": "3.8.2"
451478
}
452479
},
453480
"nbformat": 4,

0 commit comments

Comments
 (0)