From 967f6daeb8f66c6ab83d8b1c7f8ea0d73e3d51d1 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Wed, 27 Jul 2022 12:39:54 +0200
Subject: [PATCH] Add procedure `get_slice_dir`

---
 Common/get_slice_dir.f90 | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Common/get_slice_dir.f90

diff --git a/Common/get_slice_dir.f90 b/Common/get_slice_dir.f90
new file mode 100644
index 00000000..92de1387
--- /dev/null
+++ b/Common/get_slice_dir.f90
@@ -0,0 +1,29 @@
+module get_slice_dir_m
+
+  implicit none
+
+contains
+
+  pure function get_slice_dir(shpc_dir, cyclone, slice)
+
+    character(len = :), allocatable:: get_slice_dir
+    character(len = *), intent(in):: shpc_dir
+    logical, intent(in):: cyclone
+    integer, intent(in):: slice
+
+    ! Local:
+    character(len = 10) slice_part
+
+    !-------------------------------------------------------------
+
+    write(unit = slice_part, fmt = "(a, i0)") "Slice_", slice
+
+    if (cyclone) then
+       get_slice_dir = shpc_dir // "/Cyclones/" // trim(slice_part)
+    else
+       get_slice_dir = shpc_dir // "/Anticyclones/" // trim(slice_part)
+    end if
+
+  end function get_slice_dir
+
+end module get_slice_dir_m
-- 
GitLab