source: TOOLS/MOSAIX/nemo.py @ 3725

Last change on this file since 3725 was 3725, checked in by omamce, 6 years ago

O.M. : first step to implement run-off

  • Property svn:keywords set to Date Revision HeadURL Author Id
File size: 3.8 KB
Line 
1### ===========================================================================
2###
3### Periodicity of ORCA fields
4###
5### ===========================================================================
6##
7##  Warning, to install, configure, run, use any of Olivier Marti's
8##  software or to read the associated documentation you'll need at least
9##  one (1) brain in a reasonably working order. Lack of this implement
10##  will void any warranties (either express or implied).
11##  O. Marti assumes no responsability for errors, omissions,
12##  data loss, or any other consequences caused directly or indirectly by
13##  the usage of his software by incorrectly or partially configured
14##  personal.
15##
16## SVN information
17__Author__   = "$Author$"
18__Date__     = "$Date$"
19__Revision__ = "$Revision$"
20__Id__       = "$Id$"
21__HeadURL    = "$HeadURL$"
22
23def lbc (ptab, nperio=6, cd_type='T', psgn=1.0) :
24    # nperio    : Type of periodicity
25    #   1, 4, 6 : Cyclic on i dimension (generaly longitudes)
26    #   2       : Obsolete (was symmetric condition at southern boundary ?)
27    #   3, 4    : North fold T-point pivot (legacy ORCA2)
28    #   5, 6    : North fold F-point pivot (ORCA1, ORCA025, ORCA2 with new grid for paleo)
29    # ptab     : Input array
30    #   rank 2 at least : patb[[...., lat, lon]
31    # cd_type  : Grid specification : T, U, V or F
32    # psgn     : For change of sign for vector components
33    #
34    # See NEMO documentation for further details
35   
36    jpi = ptab.shape[-1]
37   
38    #
39    #> East-West boundary conditions
40    # --------------------------------
41
42    if nperio in [1, 4, 6] :
43        # ... cyclic
44        ptab [...,:,  0] = ptab [...,:,-2]
45        ptab [...,:, -1] = ptab [...,:, 1]
46   
47    #
48    #> North-South boundary conditions
49    # ----------------------------------
50    if nperio in [3, 4] :  # North fold T-point pivot     
51        if cd_type in [ 'T', 'W' ] : # T-, W-point
52            ptab[..., -1, 1:      ] = psgn * ptab[..., -3, -1:0:-1]     
53            ptab[..., -1, 0]        = psgn * ptab[..., -3, 2]
54            ptab[..., -2, jpi/2:  ] = psgn * ptab[..., -2, jpi/2:0:-1]
55                     
56        if cd_type == 'U' :
57            ptab[..., -1, 0:-1    ] = psgn * ptab[..., -3, -1:0:-1  ]       
58            ptab[..., -1,  0]       = psgn * ptab[..., -3,  1]
59            ptab[..., -1, -1]       = psgn * ptab[..., -3, -2] 
60            ptab[..., -2, jpi/2-1:] = psgn * ptab[..., -2, jpi/2+1:0:-1]
61           
62        if cd_type == 'V' : 
63            ptab[..., -2, 1:      ] = psgn * ptab[..., -3, jpi-1:0:-1]
64            ptab[..., -1, 1:      ] = psgn * ptab[..., -4, -1:0:-1]   
65            ptab[..., -1, 0]        = psgn * ptab[..., -4, 2]
66           
67        if cd_type == 'F' :
68            ptab[..., -2, 0:-1    ] = psgn * ptab[..., -3, -1:0:-1]
69            ptab[..., -1, 0:-1    ] = psgn * ptab[..., -4, -1:0:-1]
70            ptab[..., -1,  0]       = psgn * ptab[..., -4,  1]
71            ptab[..., -1, -1]       = psgn * ptab[..., -4, -2] 
72     
73    if nperio in [5, 6] :            #  North fold F-point pivot 
74        if cd_type in ['T', 'W']  :
75            ptab[..., -1, 0:      ] = psgn * ptab[..., -2, -1::-1]
76               
77        if cd_type == 'U' :
78            ptab[..., -1, 0:-1    ] = psgn * ptab[..., -2, -2::-1]       
79            ptab[..., -1, -1]       = psgn * ptab[..., -2, 0]
80             
81        if cd_type == 'V' :
82            ptab[..., -1, 0:      ] = psgn * ptab[..., -3, -1::-1   ]
83            ptab[..., -2, jpi/2:  ] = psgn * ptab[..., -2, jpi/2-1::-1]
84                             
85        if cd_type == 'F' :
86            ptab[..., -1, 0:-1    ] = psgn * ptab[..., -3, -2::-1]
87            ptab[..., -1, -1]       = psgn * ptab[..., -3, 0]
88            ptab[..., -2, jpi/2:-1] = psgn * ptab[..., -2, jpi/2-2::-1]
89
90    return ptab
91################################
92       
Note: See TracBrowser for help on using the repository browser.