<html 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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Courier;
panose-1:0 0 0 0 0 0 0 0 0 0;}
@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:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-AU" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Let’s 3 you have a 3d array x(time, lat, lon). You need to change the lon values BUT you probably also need to reorder so that lon is monotonic:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">lon = where(x&lon.lt.0., x&lon+360, x&lon) ; change to a 0-360 array<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">pq = dim_pqsort(lon,2) ;rearrange to a monotonic coord<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">x = x(:,:,pq)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">x&lon = (/ lon /) <o:p>
</o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Will<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">ncl-talk <ncl-talk-bounces@mailman.ucar.edu> on behalf of "R. Lucas via ncl-talk" <ncl-talk@mailman.ucar.edu><br>
<b>Reply to: </b>"R. Lucas" <rousslucas@gmail.com><br>
<b>Date: </b>Tuesday, 18 January 2022 at 4:22 pm<br>
<b>To: </b>"ncl-talk@mailman.ucar.edu" <ncl-talk@mailman.ucar.edu><br>
<b>Subject: </b>[ncl-talk] Regrid - Longitude<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">Dear NCL users<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I try to flip longitude from -180 - 180 degrees to 0 - 360<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div style="mso-element:para-border-div;border:solid windowtext 1.0pt;border-bottom:solid windowtext 6.0pt;padding:0cm 0cm 0cm 0cm">
<pre style="line-height:12.0pt;border:none;padding:0cm;border-color:transparent"><span style="font-family:Courier;color:black">function lonFlip (<o:p></o:p></span></pre>
<pre style="line-height:12.0pt;border:none;padding:0cm"><span style="font-family:Courier;color:black"> x : numeric <o:p></o:p></span></pre>
<pre style="line-height:12.0pt;border:none;padding:0cm"><span style="font-family:Courier;color:black"> )<o:p></o:p></span></pre>
</div>
</div>
<div>
<p class="MsoNormal">doesnt work.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">gsnaddcyclic doesnt work.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">neither "longitude = longitude + 360"<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">what can I try?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Many thanks.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">Variable: waveheight<br>
Type: short<br>
Total Size: 1684122 bytes<br>
842061 values<br>
Number of Dimensions: 2<br>
Dimensions and sizes: [latitude | 1501] x [longitude | 561]<br>
Coordinates: <br>
latitude: [43.3..45.8]<br>
longitude: [-1.9..-0.5]<br>
Number Of Attributes: 9<br>
time : 11704.33333333333<br>
long_name : significant height of wind and swell waves<br>
standard_name : sea_surface_wave_significant_height<br>
units : m<br>
_FillValue : -32767<br>
scale_factor : 0.002<br>
add_offset : 0<br>
valid_min : 0<br>
valid_max : 32000<o:p></o:p></p>
</div>
</div>
<p style="font-size:10pt; line-height:10pt; font-family: Calibri,sans-serif;"><br>
<br>
This email is confidential, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone outside the intended recipient organisation is prohibited and may be a criminal offence. Please delete if obtained
in error and email confirmation to the sender. The views expressed in this email are not necessarily the views of the University of Tasmania, unless clearly intended otherwise.</p>
</body>
</html>