MCPcopy Create free account
hub / github.com/NCAR/wrf-python / _cape

Function _cape

src/wrf/extension.py:626–678  ·  view source on GitHub ↗

Wrapper for dcapecalc3d. Located in rip_cape.f90.

(p_hpa, tk, qv, ht, ter, sfp, missing, i3dflag, ter_follow,
          psafile=psafilepath(), capeview=None, cinview=None)

Source from the content-addressed store, hash-verified

624@cast_type(arg_idxs=(0, 1, 2, 3, 4, 5), outviews=("capeview", "cinview"))
625@extract_and_transpose(outviews=("capeview", "cinview"))
626def _cape(p_hpa, tk, qv, ht, ter, sfp, missing, i3dflag, ter_follow,
627 psafile=psafilepath(), capeview=None, cinview=None):
628 """Wrapper for dcapecalc3d.
629
630 Located in rip_cape.f90.
631
632 """
633 if capeview is None:
634 capeview = np.zeros(p_hpa.shape[0:3], p_hpa.dtype, order="F")
635
636 if cinview is None:
637 cinview = np.zeros(p_hpa.shape[0:3], p_hpa.dtype, order="F")
638
639 errstat = np.array(0)
640 errmsg = np.zeros(Constants.ERRLEN, "c")
641
642 if i3dflag:
643 cape_routine = dcapecalc3d
644 else:
645 cape_routine = dcapecalc2d
646
647 # Work arrays
648 k_left_shape = (p_hpa.shape[2], p_hpa.shape[0], p_hpa.shape[1])
649 prsf = np.empty(k_left_shape, np.float64, order="F")
650 prs_new = np.empty(k_left_shape, np.float64, order="F")
651 tmk_new = np.empty(k_left_shape, np.float64, order="F")
652 qvp_new = np.empty(k_left_shape, np.float64, order="F")
653 ght_new = np.empty(k_left_shape, np.float64, order="F")
654
655 # note that p_hpa, tk, qv, and ht have the vertical flipped
656 result = cape_routine(p_hpa,
657 tk,
658 qv,
659 ht,
660 ter,
661 sfp,
662 capeview,
663 cinview,
664 prsf,
665 prs_new,
666 tmk_new,
667 qvp_new,
668 ght_new,
669 missing,
670 ter_follow,
671 psafile,
672 errstat,
673 errmsg)
674
675 if int(errstat) != 0:
676 raise DiagnosticError("".join(npbytes_to_str(errmsg)).strip())
677
678 return result
679
680
681@check_args(0, 3, (3, 3))

Callers 4

get_2dcapeFunction · 0.85
get_3dcapeFunction · 0.85
cape_2dFunction · 0.85
cape_3dFunction · 0.85

Calls 3

psafilepathFunction · 0.85
DiagnosticErrorClass · 0.85
npbytes_to_strFunction · 0.85

Tested by

no test coverage detected