Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 48f09a2

Browse files
authored
Merge pull request #132 from ICESat2-SlideRule/dev
fix: validate boolean entries in JSON dump to be title case for #282
2 parents 1865f62 + 27d1bba commit 48f09a2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

demo/voila_demo.ipynb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"import warnings\n",
7474
"import time\n",
7575
"import json\n",
76+
"import re\n",
7677
"from IPython import display\n",
7778
"# atl03 plotting imports\n",
7879
"import numpy as np\n",
@@ -334,7 +335,10 @@
334335
" with show_code06_output:\n",
335336
" display.clear_output()\n",
336337
" print(f'icesat2.init(\"{url_textbox.value}\")')\n",
337-
" print('parms = ', json.dumps(atl06_parms, indent=4), sep='')\n",
338+
" # validate boolean entries to be in title case\n",
339+
" atl06_json = json.dumps(atl06_parms, indent=4)\n",
340+
" atl06_json = re.sub(r'\\b(true|false)', lambda m: m.group(1).title(), atl06_json)\n",
341+
" print('parms = ', atl06_json, sep='')\n",
338342
" print('gdf = icesat2.atl06p(parms, asset=\"icesat2\")')\n",
339343
" \n",
340344
"# link buttons\n",
@@ -570,7 +574,10 @@
570574
" with show_code03_output:\n",
571575
" display.clear_output()\n",
572576
" print(f'icesat2.init(\"{url_textbox.value}\")')\n",
573-
" print('parms = ', json.dumps(atl03_parms, indent=4), sep='')\n",
577+
" # validate boolean entries to be in title case\n",
578+
" atl03_json = json.dumps(atl03_parms, indent=4)\n",
579+
" atl03_json = re.sub(r'\\b(true|false)', lambda m: m.group(1).title(), atl03_json)\n",
580+
" print('parms = ', atl03_json, sep='')\n",
574581
" print('gdf = icesat2.atl03sp(parms, asset=\"icesat2\")')\n",
575582
" \n",
576583
"# install click handler callback\n",
@@ -651,7 +658,7 @@
651658
"name": "python",
652659
"nbconvert_exporter": "python",
653660
"pygments_lexer": "ipython3",
654-
"version": "3.11.3"
661+
"version": "3.10.6"
655662
},
656663
"toc-showtags": false
657664
},

0 commit comments

Comments
 (0)