|
28 | 28 | "- [daylight_fao56](https://www.ncl.ucar.edu/Document/Functions/Crop/daylight_fao56.shtml)\n",
|
29 | 29 | "- [satvpr_temp_fao56](https://www.ncl.ucar.edu/Document/Functions/Crop/satvpr_temp_fao56.shtml)\n",
|
30 | 30 | "- [satvpr_tdew_fao56](https://www.ncl.ucar.edu/Document/Functions/Crop/satvpr_tdew_fao56.shtml)\n",
|
31 |
| - "- [satvpr_slope_fao56](https://www.ncl.ucar.edu/Document/Functions/Crop/satvpr_slope_fao56.shtml)" |
| 31 | + "- [satvpr_slope_fao56](https://www.ncl.ucar.edu/Document/Functions/Crop/satvpr_slope_fao56.shtml)\n", |
| 32 | + "- [coriolis_param](https://www.ncl.ucar.edu/Document/Functions/Contributed/coriolis_param.shtml)" |
32 | 33 | ]
|
33 | 34 | },
|
34 | 35 | {
|
|
339 | 340 | " geocat_satvpr_slope_fao56[temp] = saturation_vapor_pressure_slope(temp)"
|
340 | 341 | ]
|
341 | 342 | },
|
| 343 | + { |
| 344 | + "cell_type": "markdown", |
| 345 | + "id": "3b9ce2e3-833a-4dbc-8d6a-35eb86397b19", |
| 346 | + "metadata": {}, |
| 347 | + "source": [ |
| 348 | + "### coriolis_param" |
| 349 | + ] |
| 350 | + }, |
| 351 | + { |
| 352 | + "cell_type": "code", |
| 353 | + "execution_count": null, |
| 354 | + "id": "c2646150-8327-4faa-8979-b70e98be9631", |
| 355 | + "metadata": {}, |
| 356 | + "outputs": [], |
| 357 | + "source": [ |
| 358 | + "#### Collect NCL values for coriolis_param from geocat-datafiles\n", |
| 359 | + "import geocat.datafiles as gdf\n", |
| 360 | + "import numpy as np\n", |
| 361 | + "\n", |
| 362 | + "coriolis_param_data = gdf.get(\n", |
| 363 | + " 'applications_files/ncl_outputs/coriolis_param_output.txt'\n", |
| 364 | + ")\n", |
| 365 | + "coriolis_param_data = np.loadtxt(coriolis_param_data, delimiter=',', skiprows=6)" |
| 366 | + ] |
| 367 | + }, |
| 368 | + { |
| 369 | + "cell_type": "code", |
| 370 | + "execution_count": null, |
| 371 | + "id": "9a699cc2-5a21-4a49-92f9-353635036d06", |
| 372 | + "metadata": {}, |
| 373 | + "outputs": [], |
| 374 | + "source": [ |
| 375 | + "### Collect NCL `coriolis_param_data` value and associated coriolis parameter values\n", |
| 376 | + "ncl_coriolis_param = dict(zip(coriolis_param_data[::, 0], coriolis_param_data[::, 1]))" |
| 377 | + ] |
| 378 | + }, |
| 379 | + { |
| 380 | + "cell_type": "code", |
| 381 | + "execution_count": null, |
| 382 | + "id": "04410fd1-3033-4c6b-812f-e6b12b3e884e", |
| 383 | + "metadata": {}, |
| 384 | + "outputs": [], |
| 385 | + "source": [ |
| 386 | + "### Calculate MetPy \"coriolis_parameter\"\n", |
| 387 | + "from metpy.calc import coriolis_parameter\n", |
| 388 | + "from metpy.units import units\n", |
| 389 | + "\n", |
| 390 | + "metpy_coriolis_para = {}\n", |
| 391 | + "\n", |
| 392 | + "for lat in range(-90, 90 + 1):\n", |
| 393 | + " metpy_coriolis_para[lat] = coriolis_parameter(lat * units.degree).magnitude" |
| 394 | + ] |
| 395 | + }, |
342 | 396 | {
|
343 | 397 | "cell_type": "markdown",
|
344 | 398 | "id": "3237a0bffc6827fc",
|
|
469 | 523 | " ncl_satvpr_slope_fao56[key], geocat_satvpr_slope_fao56[key], rel_tol=1e-05\n",
|
470 | 524 | " ) # within 5 decimal points"
|
471 | 525 | ]
|
| 526 | + }, |
| 527 | + { |
| 528 | + "cell_type": "markdown", |
| 529 | + "id": "980c82cf-3860-4f46-bb98-65e4bea9f3cf", |
| 530 | + "metadata": {}, |
| 531 | + "source": [ |
| 532 | + "### coriolis_param" |
| 533 | + ] |
| 534 | + }, |
| 535 | + { |
| 536 | + "cell_type": "code", |
| 537 | + "execution_count": null, |
| 538 | + "id": "1229100a-0e88-46ef-afad-d557b043a713", |
| 539 | + "metadata": {}, |
| 540 | + "outputs": [], |
| 541 | + "source": [ |
| 542 | + "import math\n", |
| 543 | + "\n", |
| 544 | + "for key in ncl_coriolis_param.keys():\n", |
| 545 | + " assert math.isclose(\n", |
| 546 | + " ncl_coriolis_param[key], metpy_coriolis_para[key], rel_tol=1e-04\n", |
| 547 | + " ) # within 4 decimal points" |
| 548 | + ] |
472 | 549 | }
|
473 | 550 | ],
|
474 | 551 | "metadata": {
|
|
0 commit comments