Skip to content

Commit 477406e

Browse files
Introduce variable for resoultion of displayed images
1 parent 75c68bc commit 477406e

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

book/tut4_geophysics.ipynb

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
"source": [
5353
"import pygmt\n",
5454
"import numpy as np\n",
55-
"import pandas as pd "
55+
"import pandas as pd \n",
56+
"\n",
57+
"img_dpi = 150"
5658
]
5759
},
5860
{
@@ -579,15 +581,15 @@
579581
" history: gmt xyz2grd @GMTAPI@-S-I-D-M-T-N-000000 -G@GMTAPI@-S-O-G-G...\n",
580582
" description: \n",
581583
" long_name: z\n",
582-
" actual_range: [nan nan]</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'z'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>lat</span>: 481</li><li><span class='xr-has-index'>lon</span>: 361</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-0b52cfa8-20f5-426d-a7a5-016fcf0a50e1' class='xr-array-in' type='checkbox' checked><label for='section-0b52cfa8-20f5-426d-a7a5-016fcf0a50e1' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>-3.47e+03 -3.474e+03 -3.456e+03 -3.511e+03 ... 116.0 108.0 117.0 141.0</span></div><div class='xr-array-data'><pre>array([[-3470.5, -3474. , -3455.5, ..., -50. , -52. , -54. ],\n",
584+
" actual_range: [nan nan]</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'z'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>lat</span>: 481</li><li><span class='xr-has-index'>lon</span>: 361</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-8eeb15c2-89aa-438e-a70c-b51c8562bf02' class='xr-array-in' type='checkbox' checked><label for='section-8eeb15c2-89aa-438e-a70c-b51c8562bf02' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>-3.47e+03 -3.474e+03 -3.456e+03 -3.511e+03 ... 116.0 108.0 117.0 141.0</span></div><div class='xr-array-data'><pre>array([[-3470.5, -3474. , -3455.5, ..., -50. , -52. , -54. ],\n",
583585
" [-3447.5, -3438.5, -3436. , ..., -46. , -50.5, -51. ],\n",
584586
" [-3440.5, -3419.5, -3419. , ..., -44.5, -49. , -51. ],\n",
585587
" ...,\n",
586588
" [ -970. , -1083. , -1261.5, ..., 114. , 126.5, 129. ],\n",
587589
" [ -959. , -1044. , -1204. , ..., 110.5, 124.5, 146. ],\n",
588-
" [-1033.5, -1132.5, -1298. , ..., 108. , 117. , 141. ]])</pre></div></div></li><li class='xr-section-item'><input id='section-f0c74da0-b3aa-482f-9017-d12d56a93395' class='xr-section-summary-in' type='checkbox' checked><label for='section-f0c74da0-b3aa-482f-9017-d12d56a93395' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>lat</span></div><div class='xr-var-dims'>(lat)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-40.0 -39.92 ... -0.08333 0.0</div><input id='attrs-56f97b54-c0c3-4d02-a8a0-e20fa740a33f' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-56f97b54-c0c3-4d02-a8a0-e20fa740a33f' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-57cc5634-e504-4862-8d97-a49935aed8b3' class='xr-var-data-in' type='checkbox'><label for='data-57cc5634-e504-4862-8d97-a49935aed8b3' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>latitude</dd><dt><span>units :</span></dt><dd>degrees_north</dd><dt><span>standard_name :</span></dt><dd>latitude</dd><dt><span>axis :</span></dt><dd>Y</dd><dt><span>actual_range :</span></dt><dd>[-40. 0.]</dd></dl></div><div class='xr-var-data'><pre>array([-40. , -39.916667, -39.833333, ..., -0.166667, -0.083333,\n",
589-
" 0. ])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>lon</span></div><div class='xr-var-dims'>(lon)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-90.0 -89.92 ... -60.08 -60.0</div><input id='attrs-e8d69b4c-3449-4ab5-be50-70aeacf9667f' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-e8d69b4c-3449-4ab5-be50-70aeacf9667f' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-d7f54e80-ee61-49ff-9e3e-2ae8a50c742a' class='xr-var-data-in' type='checkbox'><label for='data-d7f54e80-ee61-49ff-9e3e-2ae8a50c742a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>longitude</dd><dt><span>units :</span></dt><dd>degrees_east</dd><dt><span>standard_name :</span></dt><dd>longitude</dd><dt><span>axis :</span></dt><dd>X</dd><dt><span>actual_range :</span></dt><dd>[-90. -60.]</dd></dl></div><div class='xr-var-data'><pre>array([-90. , -89.916667, -89.833333, ..., -60.166667, -60.083333,\n",
590-
" -60. ])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-d2ec86bc-feb6-4969-8c4d-ab5186efb8d1' class='xr-section-summary-in' type='checkbox' ><label for='section-d2ec86bc-feb6-4969-8c4d-ab5186efb8d1' class='xr-section-summary' >Indexes: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-index-name'><div>lat</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-bf8b8893-b9cf-41dc-8926-dd30e0b6f521' class='xr-index-data-in' type='checkbox'/><label for='index-bf8b8893-b9cf-41dc-8926-dd30e0b6f521' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Index([ -40.0, -39.916666666666664, -39.83333333333333,\n",
590+
" [-1033.5, -1132.5, -1298. , ..., 108. , 117. , 141. ]])</pre></div></div></li><li class='xr-section-item'><input id='section-31d1b613-b00e-4e40-990c-d3b3d38ee657' class='xr-section-summary-in' type='checkbox' checked><label for='section-31d1b613-b00e-4e40-990c-d3b3d38ee657' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>lat</span></div><div class='xr-var-dims'>(lat)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-40.0 -39.92 ... -0.08333 0.0</div><input id='attrs-6df45b59-2f43-4343-8c21-b090309ed210' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-6df45b59-2f43-4343-8c21-b090309ed210' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-24205071-a2bc-419c-bc1e-3a6b7fe1e403' class='xr-var-data-in' type='checkbox'><label for='data-24205071-a2bc-419c-bc1e-3a6b7fe1e403' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>latitude</dd><dt><span>units :</span></dt><dd>degrees_north</dd><dt><span>standard_name :</span></dt><dd>latitude</dd><dt><span>axis :</span></dt><dd>Y</dd><dt><span>actual_range :</span></dt><dd>[-40. 0.]</dd></dl></div><div class='xr-var-data'><pre>array([-40. , -39.916667, -39.833333, ..., -0.166667, -0.083333,\n",
591+
" 0. ])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>lon</span></div><div class='xr-var-dims'>(lon)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-90.0 -89.92 ... -60.08 -60.0</div><input id='attrs-6d3ede37-01a5-4610-a9e4-b2f9ead38c7c' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-6d3ede37-01a5-4610-a9e4-b2f9ead38c7c' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-02fd12f3-63a5-4174-80b2-f3b9a4d4524c' class='xr-var-data-in' type='checkbox'><label for='data-02fd12f3-63a5-4174-80b2-f3b9a4d4524c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>longitude</dd><dt><span>units :</span></dt><dd>degrees_east</dd><dt><span>standard_name :</span></dt><dd>longitude</dd><dt><span>axis :</span></dt><dd>X</dd><dt><span>actual_range :</span></dt><dd>[-90. -60.]</dd></dl></div><div class='xr-var-data'><pre>array([-90. , -89.916667, -89.833333, ..., -60.166667, -60.083333,\n",
592+
" -60. ])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-aff6e2d6-58be-4b4a-8c01-309ce0097075' class='xr-section-summary-in' type='checkbox' ><label for='section-aff6e2d6-58be-4b4a-8c01-309ce0097075' class='xr-section-summary' >Indexes: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-index-name'><div>lat</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-45fae41e-535f-4426-b1cf-12b14d751f29' class='xr-index-data-in' type='checkbox'/><label for='index-45fae41e-535f-4426-b1cf-12b14d751f29' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Index([ -40.0, -39.916666666666664, -39.83333333333333,\n",
591593
" -39.75, -39.666666666666664, -39.58333333333333,\n",
592594
" -39.5, -39.416666666666664, -39.33333333333333,\n",
593595
" -39.25,\n",
@@ -596,7 +598,7 @@
596598
" -0.5, -0.41666666666666663, -0.3333333333333333,\n",
597599
" -0.25, -0.16666666666666666, -0.08333333333333333,\n",
598600
" 0.0],\n",
599-
" dtype=&#x27;float64&#x27;, name=&#x27;lat&#x27;, length=481))</pre></div></li><li class='xr-var-item'><div class='xr-index-name'><div>lon</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-80c30303-50ff-4586-9839-276d6f8f269d' class='xr-index-data-in' type='checkbox'/><label for='index-80c30303-50ff-4586-9839-276d6f8f269d' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Index([ -90.0, -89.91666666666667, -89.83333333333333,\n",
601+
" dtype=&#x27;float64&#x27;, name=&#x27;lat&#x27;, length=481))</pre></div></li><li class='xr-var-item'><div class='xr-index-name'><div>lon</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-1ce74488-c48e-482b-b833-5b2a1c66a407' class='xr-index-data-in' type='checkbox'/><label for='index-1ce74488-c48e-482b-b833-5b2a1c66a407' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Index([ -90.0, -89.91666666666667, -89.83333333333333,\n",
600602
" -89.75, -89.66666666666667, -89.58333333333333,\n",
601603
" -89.5, -89.41666666666667, -89.33333333333333,\n",
602604
" -89.25,\n",
@@ -605,7 +607,7 @@
605607
" -60.5, -60.41666666666667, -60.333333333333336,\n",
606608
" -60.25, -60.16666666666667, -60.083333333333336,\n",
607609
" -60.0],\n",
608-
" dtype=&#x27;float64&#x27;, name=&#x27;lon&#x27;, length=361))</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-249d8eea-8dd3-4016-bb6f-b9c97d1db1b9' class='xr-section-summary-in' type='checkbox' checked><label for='section-249d8eea-8dd3-4016-bb6f-b9c97d1db1b9' class='xr-section-summary' >Attributes: <span>(6)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>Conventions :</span></dt><dd>CF-1.7</dd><dt><span>title :</span></dt><dd></dd><dt><span>history :</span></dt><dd>gmt xyz2grd @GMTAPI@-S-I-D-M-T-N-000000 -G@GMTAPI@-S-O-G-G-G-Y-000001 -I5m -R-90/-60/-40/0</dd><dt><span>description :</span></dt><dd></dd><dt><span>long_name :</span></dt><dd>z</dd><dt><span>actual_range :</span></dt><dd>[nan nan]</dd></dl></div></li></ul></div></div>"
610+
" dtype=&#x27;float64&#x27;, name=&#x27;lon&#x27;, length=361))</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-b2cab0d1-3b77-4146-9631-5eb21652d89f' class='xr-section-summary-in' type='checkbox' checked><label for='section-b2cab0d1-3b77-4146-9631-5eb21652d89f' class='xr-section-summary' >Attributes: <span>(6)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>Conventions :</span></dt><dd>CF-1.7</dd><dt><span>title :</span></dt><dd></dd><dt><span>history :</span></dt><dd>gmt xyz2grd @GMTAPI@-S-I-D-M-T-N-000000 -G@GMTAPI@-S-O-G-G-G-Y-000001 -I5m -R-90/-60/-40/0</dd><dt><span>description :</span></dt><dd></dd><dt><span>long_name :</span></dt><dd>z</dd><dt><span>actual_range :</span></dt><dd>[nan nan]</dd></dl></div></li></ul></div></div>"
609611
],
610612
"text/plain": [
611613
"<xarray.DataArray 'z' (lat: 481, lon: 361)> Size: 1MB\n",
@@ -692,7 +694,7 @@
692694
"\n",
693695
"fig.grdcontour(grid=grid, annotation=2000, levels=1000, limit=[-4000, 0], pen=\"0.5p,white\")\n",
694696
"\n",
695-
"fig.show(dpi=150)"
697+
"fig.show(dpi=img_dpi)"
696698
]
697699
},
698700
{
@@ -758,7 +760,7 @@
758760
" unit=True,\n",
759761
")\n",
760762
"\n",
761-
"fig.show(dpi=150)"
763+
"fig.show(dpi=img_dpi)"
762764
]
763765
},
764766
{
@@ -1054,7 +1056,7 @@
10541056
" font=\"12p\"\n",
10551057
")\n",
10561058
"\n",
1057-
"fig.show(dpi=150)"
1059+
"fig.show(dpi=img_dpi)"
10581060
]
10591061
},
10601062
{
@@ -1105,7 +1107,7 @@
11051107
" close=\"+y-7500\", # Force closed polygon\n",
11061108
")\n",
11071109
"\n",
1108-
"fig.show(dpi=150)"
1110+
"fig.show(dpi=img_dpi)"
11091111
]
11101112
},
11111113
{
@@ -1345,7 +1347,7 @@
13451347
" box=\"+gwhite@30\",\n",
13461348
")\n",
13471349
"\n",
1348-
"fig.show(dpi=150)"
1350+
"fig.show(dpi=img_dpi)"
13491351
]
13501352
},
13511353
{
@@ -1429,7 +1431,7 @@
14291431
" offset=\"+p0.1p,orange+s0.2c\",\n",
14301432
")\n",
14311433
" \n",
1432-
"fig.show(dpi=150)"
1434+
"fig.show(dpi=img_dpi)"
14331435
]
14341436
},
14351437
{

0 commit comments

Comments
 (0)