Skip to content

Commit

Permalink
remove step 6 from 3.Tutorial; rename file; fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
amygooch committed Oct 10, 2024
1 parent 04da336 commit 481aea4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 89 deletions.
2 changes: 1 addition & 1 deletion hands-on/session II/1.Tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@
"id": "db980ecf",
"metadata": {},
"source": [
"The followitng cell takes the loaded IDX files with Openvisus and statically visualizes it. "
"The following cell takes the loaded IDX files with Openvisus and statically visualizes it. "
]
},
{
Expand Down
93 changes: 5 additions & 88 deletions hands-on/session III/3.Tutorial_PetascaleAnalysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -375,83 +375,6 @@
"print('Step 5 done.')"
]
},
{
"cell_type": "markdown",
"id": "5e734534-d71a-4b65-b7b0-26028daea8cc",
"metadata": {},
"source": [
"## **Step 6: Calculate the percentage of world surface within the selected salinity range**"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "ab0b2e45-03d5-45cb-b41c-c876ff712195",
"metadata": {
"scrolled": true,
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"----\n",
"874800.0 380479 494321 261747\n",
"----\n",
"----\n",
"350330.355378767 106714.95416864933 494321 141260.0510085231\n",
"----\n",
"percentage of land voxels 30.46% (155,230,455 square km)\n",
"percentage of world voxels within the salinity range 40.32% (205,480,686 square km)\n",
"percentage of water voxels within the salinity range 57.98%\n"
]
}
],
"source": [
"import math\n",
"total_voxels = np.ones((data.shape[0] , data.shape[1])) \n",
"longitude_levels = data.shape[0] \n",
"latitude_levels = data.shape[1] \n",
"#longitude_levels = 11\n",
"min_longitude = -90\n",
"max_longitude = 75\n",
"longitude_values = np.linspace(min_longitude, max_longitude, num=longitude_levels)\n",
"\n",
"world_chord_lengths = np.sin(((90- np.abs(longitude_values))/2) * np.pi / 180)\n",
"\n",
"world_lenghth_mask = np.transpose(np.atleast_2d(world_chord_lengths).repeat(repeats=latitude_levels, axis=0))\n",
"#print (world_lenghth_mask)\n",
"\n",
"total_surface = np.sum(total_voxels) \n",
"land_surface = np.sum(data_land)\n",
"sea_surface = np.sum( data_sea)\n",
"white_surface = np.sum(data_binary)\n",
"print(\"----\")\n",
"print(total_surface,land_surface,sea_surface, white_surface )\n",
"print(\"----\")\n",
"\n",
"total_voxels = np.multiply(total_voxels, world_lenghth_mask)\n",
"white_voxels = np.multiply(data_binary, world_lenghth_mask)\n",
"land_voxels = np.multiply(data_land, world_lenghth_mask)\n",
"sea_voxels = np.multiply(data_sea , world_lenghth_mask)\n",
"\n",
"world_surface_area = 509600000 #square km\n",
"\n",
"total_surface = np.sum(total_voxels) \n",
"land_surface = np.sum(land_voxels)\n",
"sea_surface = np.sum ( data_sea)\n",
"white_surface = np.sum(white_voxels)\n",
"print(\"----\")\n",
"print(total_surface,land_surface,sea_surface, white_surface )\n",
"print(\"----\")\n",
"\n",
"print(\"percentage of land voxels\", '{:.2%}'.format(land_surface/total_surface),\" (\" '{:,}'.format(int(land_surface/total_surface*world_surface_area)),\"square km)\")\n",
"print(\"percentage of world voxels within the salinity range\", '{:.2%}'.format(white_surface/(total_surface)) ,\" (\" '{:,}'.format(int(white_surface/total_surface*world_surface_area)),\"square km)\")\n",
"print(\"percentage of water voxels within the salinity range\", '{:.2%}'.format(white_surface/(total_surface-land_surface)))\n",
"print('Step 6 done.')"
]
},
{
"cell_type": "markdown",
"id": "763806d3-ed89-44b1-8797-2299129c5ad9",
Expand All @@ -460,7 +383,7 @@
"## **OBSERVE: Summary of test Results on desktop at different resolutions**\n",
"## Note, you may want to look above and change the data resolution and see what results you get\n",
"\n",
"## **Step 7: Exercise for the user**: How many errors are generated if you change the resolution? Note: the lower number means less data, which means more errors.\n",
"## **Step 6: Exercise for the user**: How many errors are generated if you change the resolution? Note: the lower number means less data, which means more errors.\n",
"\n",
"Test at data resolution 0 <br>\n",
"55987200 24342221 16750511 <br>\n",
Expand Down Expand Up @@ -497,10 +420,7 @@
"execution_count": null,
"id": "5b2578187af7a10",
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
"collapsed": false
},
"outputs": [],
"source": []
Expand All @@ -510,7 +430,7 @@
"id": "25eabbf6-5e69-4cca-9b19-4bf4f39e2c9b",
"metadata": {},
"source": [
"## **Step 8: But, what if you want to see the full data for a certain region at a certain depth?**\n",
"## **Step 7: But, what if you want to see the full data for a certain region at a certain depth?**\n",
"\n",
"Set the proper x,y,z while reading the data. x and y are the bounding box, z is the depth/layer. \n"
]
Expand All @@ -521,9 +441,6 @@
"id": "2504ff1ba9b17453",
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
},
"scrolled": true
},
"outputs": [
Expand Down Expand Up @@ -598,7 +515,7 @@
}
],
"source": [
"#Step 8b)\n",
"#Step 7b)\n",
"# Use the x1, x2 y1 y2 region you set up above to read a subregion into the variable data_sub\n",
"data_sub=db.read(time=0,z=[0,1],x=[x1,x2],y=[y1,y2])\n",
"plt.imshow(data_sub[0,:,:], origin='lower',vmin=33,vmax=36,cmap='viridis')\n",
Expand All @@ -610,7 +527,7 @@
"id": "5fb5dfb4-4cb5-4b1f-883d-dc51ab629ebe",
"metadata": {},
"source": [
"# **Step 9: Exercise for the user**: Change the region and try the calculations from above on the new region of interest \n",
"# **Step 8: Exercise for the user**: Change the region and try the calculations from above on the new region of interest \n",
" \n",
"# **What calculations do you want to run on that subregion?**"
]
Expand Down

0 comments on commit 481aea4

Please sign in to comment.