|
1290 | 1290 | "cell_type": "markdown", |
1291 | 1291 | "metadata": {}, |
1292 | 1292 | "source": [ |
1293 | | - "The geothermal flux contribution is not accounted for in any of the standard model diagnostics provided as output. Rather, this term, which is time invariant, is provided in the input file `geothermalFlux.bin` and can be downloaded from the PO.DAAC drive (https://ecco.jpl.nasa.gov/drive/files/Version4/Release3/input_init/geothermalFlux.bin)." |
| 1293 | + "The geothermal flux contribution is not accounted for in any of the standard model diagnostics provided as output. Rather, this term, which is time invariant, is provided in the input file `geothermalFlux.bin` and can be downloaded from the PO.DAAC drive (https://ecco.jpl.nasa.gov/drive/files/Version4/Release3/input_init/geothermalFlux.bin).\n", |
| 1294 | + "> **Note**: Here, `geothermalFlux.bin` has been placed in `base_dir`." |
1294 | 1295 | ] |
1295 | 1296 | }, |
1296 | 1297 | { |
|
1299 | 1300 | "metadata": {}, |
1300 | 1301 | "outputs": [], |
1301 | 1302 | "source": [ |
1302 | | - "# Here geothermalFlux.bin has been saved in base_dir.\n", |
1303 | | - "geoflx = np.fromfile(base_dir + '/geothermalFlux.bin', dtype=np.float32)" |
| 1303 | + "# Load the geothermal heat flux using the routine 'read_llc_to_tiles'\n", |
| 1304 | + "geoflx = ecco.read_llc_to_tiles(base_dir, 'geothermalFlux.bin')" |
1304 | 1305 | ] |
1305 | 1306 | }, |
1306 | 1307 | { |
1307 | 1308 | "cell_type": "markdown", |
1308 | 1309 | "metadata": {}, |
1309 | 1310 | "source": [ |
1310 | | - "> **Note**: Geothermal flux needs to be saved as an xarray data array with the same format as the model output. In order to reformat the loaded data array the byte-ordering needs to be changed." |
| 1311 | + "The geothermal flux dataset needs to be saved as an xarray data array with the same format as the model output." |
1311 | 1312 | ] |
1312 | 1313 | }, |
1313 | 1314 | { |
1314 | 1315 | "cell_type": "code", |
1315 | | - "execution_count": 54, |
| 1316 | + "execution_count": 56, |
1316 | 1317 | "metadata": {}, |
1317 | 1318 | "outputs": [], |
1318 | 1319 | "source": [ |
1319 | | - "# Data and type endianness don't match. Change data to match dtype and reshape to 1d\n", |
1320 | | - "geoflx = geoflx.byteswap().reshape([105300,1])" |
| 1320 | + "# Convert numpy array to an xarray DataArray with matching dimensions as the monthly mean fields\n", |
| 1321 | + "geoflx_llc = xr.DataArray(geoflx,coords={'tile': ecco_monthly_mean.tile.values,\n", |
| 1322 | + " 'j': ecco_monthly_mean.j.values,\n", |
| 1323 | + " 'i': ecco_monthly_mean.i.values},dims=['tile','j','i'])" |
1321 | 1324 | ] |
1322 | 1325 | }, |
1323 | 1326 | { |
1324 | 1327 | "cell_type": "code", |
1325 | | - "execution_count": 55, |
| 1328 | + "execution_count": null, |
1326 | 1329 | "metadata": {}, |
1327 | 1330 | "outputs": [], |
1328 | 1331 | "source": [ |
1329 | | - "# Reshape data for each face and save as xarray data array in LLC format\n", |
1330 | | - "geoflx00 = xr.DataArray(geoflx[:8100,0].reshape([90,90]),coords=[np.arange(0,90,1),np.arange(0,90,1)],\n", |
1331 | | - " dims=['j','i'])\n", |
1332 | | - "geoflx01 = xr.DataArray(geoflx[8100:16200,0].reshape([90,90]),coords=[np.arange(0,90,1),np.arange(0,90,1)],\n", |
1333 | | - " dims=['j','i'])\n", |
1334 | | - "geoflx02 = xr.DataArray(geoflx[16200:24300,0].reshape([90,90]),coords=[np.arange(0,90,1),np.arange(0,90,1)],\n", |
1335 | | - " dims=['j','i'])\n", |
1336 | | - "geoflx03 = xr.DataArray(geoflx[24300:32400,0].reshape([90,90]),coords=[np.arange(0,90,1),np.arange(0,90,1)],\n", |
1337 | | - " dims=['j','i'])\n", |
1338 | | - "geoflx04 = xr.DataArray(geoflx[32400:40500,0].reshape([90,90]),coords=[np.arange(0,90,1),np.arange(0,90,1)],\n", |
1339 | | - " dims=['j','i'])\n", |
1340 | | - "geoflx05 = xr.DataArray(geoflx[40500:48600,0].reshape([90,90]),coords=[np.arange(0,90,1),np.arange(0,90,1)],\n", |
1341 | | - " dims=['j','i'])\n", |
1342 | | - "geoflx06 = xr.DataArray(geoflx[48600:56700,0].reshape([90,90]),coords=[np.arange(0,90,1),np.arange(0,90,1)],\n", |
1343 | | - " dims=['j','i'])\n", |
1344 | | - "\n", |
1345 | | - "geoflx0709 = geoflx[56700:81000,0].reshape([90,270])\n", |
1346 | | - "geoflx07 = xr.DataArray(geoflx0709[:,:90],coords=[np.arange(0,90,1),np.arange(0,90,1)],dims=['j','i'])\n", |
1347 | | - "geoflx08 = xr.DataArray(geoflx0709[:,90:180],coords=[np.arange(0,90,1),np.arange(0,90,1)],dims=['j','i'])\n", |
1348 | | - "geoflx09 = xr.DataArray(geoflx0709[:,180:],coords=[np.arange(0,90,1),np.arange(0,90,1)],dims=['j','i'])\n", |
| 1332 | + "plt.figure(figsize=(15,5));\n", |
1349 | 1333 | "\n", |
1350 | | - "geoflx1012 = geoflx[81000:,0].reshape([90,270])\n", |
1351 | | - "geoflx10 = xr.DataArray(geoflx1012[:,:90],coords=[np.arange(0,90,1),np.arange(0,90,1)],dims=['j','i'])\n", |
1352 | | - "geoflx11 = xr.DataArray(geoflx1012[:,90:180],coords=[np.arange(0,90,1),np.arange(0,90,1)],dims=['j','i'])\n", |
1353 | | - "geoflx12 = xr.DataArray(geoflx1012[:,180:],coords=[np.arange(0,90,1),np.arange(0,90,1)],dims=['j','i'])" |
1354 | | - ] |
1355 | | - }, |
1356 | | - { |
1357 | | - "cell_type": "code", |
1358 | | - "execution_count": 56, |
1359 | | - "metadata": {}, |
1360 | | - "outputs": [], |
1361 | | - "source": [ |
1362 | | - "geoflx_llc = xr.concat([geoflx00,geoflx01,geoflx02,geoflx03,geoflx04,geoflx05,geoflx06,\n", |
1363 | | - " geoflx07,geoflx08,geoflx09,geoflx10,geoflx11,geoflx12], 'tile')" |
| 1334 | + "ecco.plot_proj_to_latlon_grid(ecco_grid.XC, ecco_grid.YC, geoflx_llc,show_colorbar=True,cmap='magma', \n", |
| 1335 | + " user_lon_0=-67, dx=0.2, dy=0.2)\n", |
| 1336 | + "plt.title(r'Geothermal heat flux [W m$^{-2}$]', fontsize=16)\n", |
| 1337 | + "plt.show()" |
1364 | 1338 | ] |
1365 | 1339 | }, |
1366 | 1340 | { |
1367 | 1341 | "cell_type": "markdown", |
1368 | 1342 | "metadata": {}, |
1369 | 1343 | "source": [ |
1370 | | - ">**Note**: Geothermal flux needs to be a three dimensional field since the sources are distributed along the ocean floor at various depths. This requires a three dimensional mask (see below)." |
| 1344 | + "Geothermal flux needs to be a three dimensional field since the sources are distributed along the ocean floor at various depths. This requires a three dimensional mask." |
1371 | 1345 | ] |
1372 | 1346 | }, |
1373 | 1347 | { |
|
0 commit comments