<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Consolas;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:Consolas;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoPlainText" style="margin-bottom:12.0pt"><span style="font-family:"Courier New"">Dear ncl'ers,<br>
<br>
I have a 2d gridded temperature data on a rectangular domain with (j,i) = (nlats-1,nlons-1) dimensions<br>
and need to add 1-grid cell perimeter around the rectangular domain into a 1d array in anti-clockwise direction<br>
sequentially as boundary conditions (please see the figure below):<br>
<br>
<br>
                   (nlats-1,0)   3rd segment (left)    (nlats-1,nlons-1)<br>
                          o--------------------------------o<br>
                          |                                |<br>
                          |                                |<br>
                          |                                |<br>
                          |                                |  <br>
                          |                                |  <br>
                          |                                |  <br>
        4th segment(down) |                                |  <br>
                          |                                |  2nd segment (up)<br>
                          |                              j | <br>
                          |                                |<br>
                          |                                |<br>
                          |                                |<br>
                          |                                |<br>
                          |                                |<br>
                          |                                |<br>
                          |               i                |<br>
                          o--------------------------------o<br>
                       (0,0)                           (0,nlons-1)<br>
                                     1st segment (right)<br>
<br>
I am assigning the 1d variable, t1d, with the values of t2d along the perimeter of the domain. I need to mention that<br>
I am shifting the values in each perimeter section, 1-grid cell below, right, above and left of the corresponding<br>
perimeter section, respectively, to create 1-grid cell boundary along the perimeter that allows me to write the corner<br>
values twice to complete the perimeter of the boundary condition in t1d array.  <br>
<br>
While the bottom W-E and right S-N values are correctly filled, I cannot confirm the correct values of t1d
<br>
on the top E-W and left N-S section of the domain by looking at the printout. <br>
<br>
Could you help me to identify where I am making the logic/index mistake during the assignment, or I may have populated
<br>
the 1d array properly, but my print statements maybe incorrect? I would appreciate any help.<br>
<br>
Thank you very much.<br>
<br>
Kemal.<br>
<br>
------------<br>
<br>
Assignment:<br>
<br>
   t1d(0:nlons-1) = (/ t2d(0,0:nlons-1) /)                                ; bottom perimeter<br>
   t1d(nlons:nlons+nlats-1) = (/ t2d(0:nlats-1,nlons-1) /)                ; right perimeter<br>
   t1d(nlons+nlats:nlons+nlats+nlons-1) = (/ t2d(nlats-1,nlons-1:0:-1) /) ; top perimeter<br>
   t1d(nlons+nlats+nlons:2*nlats+2*nlons-1) = (/ t2d(nlats-1:0:-1,0) /)   ; left perimeter<br>
<br>
To print:<br>
<br>
   print2d("t2d(0,0)="+t2d(0,0)+", t2d(0,1)="+t2d(0,1)+", t2d(0,2)="+t2d(0,2))<br>
   print2d("t1d(0)="+t1d(0)+", t1d(1)="+t1d(1)+", t1d(2)="+t1d(2))<br>
   print2d("")<br>
<br>
   print2d("t2d(0,nlons-3)="+t2d(0,nlons-3)+", t2d(0,nlons-2)="+t2d(0,nlons-2)+", t2d(0,nlons-1)="+t2d(0,nlons-1))<br>
   print2d("t1d(nlons-3)="+t1d(nlons-3)+", t1d(nlons-2)="+t1d(nlons-2)+", t1d(nlons-1)="+t1d(nlons-1))<br>
   print2d("t2d(0,nlons-1)="+t2d(0,nlons-1)+", t2d(1,nlons-1)="+t2d(1,nlons-1)+", t2d(2,nlons-1)="+t2d(2,nlons-1))<br>
   print2d("t1d(nlons)="+t1d(nlons)+", t1d(nlons+1)="+t1d(nlons+1)+", t1d(nlons+2)="+t1d(nlons+2))<br>
<br>
   print2d("t2d(nlats-3,nlons-1)="+t2d(nlats-3,nlons-1)+", t2d(nlats-2,nlons-1)="+t2d(nlats-2,nlons-1)+", t2d(nlats-1,nlons-1)="+t2d(nlats-1,nlons-1))<br>
   print2d("t1d(nlons+nlats-3)="+t1d(nlons+nlats-3)+", t1d(nlons+nlats-2)="+t1d(nlons+nlats-2)+", t1d(nlons+nlats-1)="+t1d(nlons+nlats-1))<br>
<br>
   print2d("t2d(nlats-1,nlons-1)="+t2d(nlats-1,nlons-1)+", t2d(nlats-1,nlons-2)="+t2d(nlats-1,nlons-2)+", t2d(nlats-1,nlons-3)="+t2d(nlats-1,nlons-3))<br>
   print2d("t1d(nlons+nlats-1)="+t1d(nlons+nlats-1)+", t1d(nlons+nlats)="+t1d(nlons+nlats)+", t1d(nlons+nlats+1)="+t1d(nlons+nlats+1))<br>
<br>
Results:<br>
<br>
(0)     t2d(0,0)=292.185, t2d(0,1)=292.21, t2d(0,2)=292.221<br>
(0)     t1d(0)=292.185, t1d(1)=292.21, t1d(2)=292.221<br>
(0)     <br>
(0)     t2d(0,nlons-3)=311.413, t2d(0,nlons-2)=310.999, t2d(0,nlons-1)=309.555<br>
(0)     t1d(nlons-3)=311.413, t1d(nlons-2)=310.999, t1d(nlons-1)=309.555<br>
(0)     <br>
(0)     t2d(0,nlons-1)=309.555, t2d(1,nlons-1)=309.37, t2d(2,nlons-1)=308.421<br>
(0)     t1d(nlons)=309.555, t1d(nlons+1)=309.37, t1d(nlons+2)=308.421<br>
(0)     <br>
(0)     t2d(nlats-3,nlons-1)=302.655, t2d(nlats-2,nlons-1)=301.317, t2d(nlats-1,nlons-1)=302.387<br>
(0)     t1d(nlons+nlats-3)=302.655, t1d(nlons+nlats-2)=301.317, t1d(nlons+nlats-1)=302.387<br>
(0)     <br>
(0)     t2d(nlats-1,nlons-1)=302.387, t2d(nlats-1,nlons-2)=306.002, t2d(nlats-1,nlons-3)=307.029<br>
(0)     t1d(nlons+nlats-1)=302.387, t1d(nlons+nlats)=291.174, t1d(nlons+nlats+1)=291.15<br>
(0)     <br>
(0)     t2d(nlats-1,0)=291.174, t2d(nlats-1,1)=291.15, t2d(nlats-1,2)=291.146<br>
(0)     t1d(nlons+nlats+nlons-1)=302.387, t1d(nlons+nlats+nlons-2)=306.002, t1d(nlons+nlats+nlons-3)=307.029<br>
(0)     <br>
(0)     t2d(nlats-1,0)=291.174, t2d(nlats-2,0)=291.182, t2d(nlats-3,0)=291.197<br>
(0)     t1d(nlons+nlats+nlons-1)=302.387, t1d(nlons+nlats+nlons)=292.185, t1d(nlons+nlats+nlons+1)=292.122<br>
(0)     <br>
(0)     t2d(2,0)=292.047, t2d(1,0)=292.122, t2d(0,0)=292.185<br>
(0)     t1d(2*nlons+2*nlats-3)=291.197, t1d(2*nlons+2*nlats-2)=291.182, t1d(2*nlons+2*nlats-1)=291.174
<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>