<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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><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:"Andale Mono";
panose-1:2 11 5 9 0 0 0 0 0 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:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{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: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="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Wendi,<o:p></o:p></p>
<p class="MsoNormal">What you have is station data, not gridded data. Here is some python3 code I wrote that will create a station data file. There may be other ways to do this, but I’ve been working in Python lately, so it’s fresh (for me). This will create
a descriptor file for you, but you must run stnmap on it and then you can display it in GrADS:
<o:p></o:p></p>
<p class="MsoNormal"><img width="662" height="762" style="width:6.8958in;height:7.9375in" id="Picture_x0020_5" src="cid:image001.png@01D52809.B9A431E0"><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">import os<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">import struct<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""># write a station report header<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">def writeHdr (stnfp,stid,lat,lon,t,ngrp,flag) :<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> stnfp.write(bytes(stid,'utf8'))<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> stnfp.write(struct.pack("f",lat))<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> stnfp.write(struct.pack("f",lon))<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> stnfp.write(struct.pack("f",t))<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> stnfp.write(struct.pack("i",ngrp))<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> stnfp.write(struct.pack("i",flag))<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""># write a station report value<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">def writeVal(stnfp,val) :<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> stnfp.write(struct.pack("f",val))<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""># Open the file<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">fn = 'RDCA20150803_0305.txt'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">fp = open(fn,"r")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""># build file names for station data, descriptor, and stnmap<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">root,ext = os.path.splitext(fn)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">stnfn = root+'.stn'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">ctlfn = root+'.ctl'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">mapfn = root+'.map'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">stnfp = open(stnfn, 'wb')<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">i=0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">for line in fp:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> lon = float(line.strip().split()[0])<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> lat = float(line.strip().split()[1])<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> val = float(line.strip().split()[2])<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> if val > -900 :
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> i=i+1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> # write out the data<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> stid=("%8d" % i);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> t=0.0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> flag=1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> ngrp=1
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> # write a report header<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> writeHdr(stnfp,stid,lat,lon,t,ngrp,flag)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> # write sfc variables<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> writeVal(stnfp,val)
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> writeVal(stnfp,lon)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""> writeVal(stnfp,lat)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""># write a terminator header<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">ngrp=0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">flag=0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">writeHdr(stnfp,stid,lat,lon,t,ngrp,flag)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">stnfp.close()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""># write a descriptor file<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">ctlfp = open(ctlfn, 'w+')<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">ctlfp.write("dset ^"+stnfn+"\n")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">ctlfp.write("dtype station\n")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">ctlfp.write("stnmap ^"+mapfn+"\n")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">ctlfp.write("undef -999.000\n")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">ctlfp.write("tdef 1 linear 03aug2015 1hr\n")
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">ctlfp.write("vars 3\n")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">ctlfp.write("val 0 99 Value\n")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">ctlfp.write("slon 0 99 Longitude\n")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">ctlfp.write("slat 0 99 Latitude\n")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">ctlfp.write("endvars\n")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono"">ctlfp.close()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Andale Mono""><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt">-- <span style="color:black"><br>
Jennifer Miletta Adams<br>
ADNET Systems, Inc.<br>
NASA/GSFC, Code 610.2</span><o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;color:black">Building 32, Room S159<br>
(301) 614-6070<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">gradsusr <gradsusr-bounces@gradsusr.org> on behalf of wendi harjupa <wendiharjupa@gmail.com><br>
<b>Reply-To: </b>GrADS Users Forum <gradsusr@gradsusr.org><br>
<b>Date: </b>Wednesday, June 19, 2019 at 8:30 AM<br>
<b>To: </b>GrADS Users Forum <gradsusr@gradsusr.org><br>
<b>Subject: </b>[gradsusr] ctl file for irregular lon and lat dimension<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Dear GrADS user, <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I want to plot the data which has irregular lon and lat...<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I donot want to interpolate the data, so I just want to plot it as the original data.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">My question is how to make the control file for the irregular lon and lat data.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I attach two data through this email,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">1. asci data which shows the different of lon and lat of the data.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">2. Binary format data of the asci data.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thank you very much for your help.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">best regards<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">wendi<o:p></o:p></p>
</div>
<div style="border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px">
<p class="MsoNormal" style="background:whitesmoke"><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif"><a href="https://drive.google.com/file/d/1HDCQXO30JwIRCaxTL-H1pf6eibRvhTpp/view?usp=drive_web" target="_blank"><span style="border:none windowtext 1.0pt;padding:0in;text-decoration:none"><img border="0" width="32" height="32" style="width:.3333in;height:.3333in" id="_x0000_i1028" src="cid:~WRD000.jpg" alt="Image removed by sender."></span><span style="border:none windowtext 1.0pt;padding:0in"> </span><span style="border:none windowtext 1.0pt;padding:0in;text-decoration:none">RDCA20150803_0305.bin</span></a><span style="border:solid windowtext 1.0pt;padding:0in"><img border="0" width="32" height="32" style="width:.3333in;height:.3333in" id="_x0000_i1027" src="cid:~WRD000.jpg" alt="Image removed by sender."></span><o:p></o:p></span></b></p>
</div>
<div style="border:solid #DDDDDD 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;max-height:18px">
<p class="MsoNormal" style="background:whitesmoke"><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif"><a href="https://drive.google.com/file/d/1l0vSZLO0Z21aBlfuMLF2UJM02m0kXTtC/view?usp=drive_web" target="_blank"><span style="border:none windowtext 1.0pt;padding:0in;text-decoration:none"><img border="0" width="32" height="32" style="width:.3333in;height:.3333in" id="_x0000_i1026" src="cid:~WRD000.jpg" alt="Image removed by sender."></span><span style="border:none windowtext 1.0pt;padding:0in"> </span><span style="border:none windowtext 1.0pt;padding:0in;text-decoration:none">RDCA20150803_0305.txt</span></a><span style="border:solid windowtext 1.0pt;padding:0in"><img border="0" width="32" height="32" style="width:.3333in;height:.3333in" id="_x0000_i1025" src="cid:~WRD000.jpg" alt="Image removed by sender."></span><o:p></o:p></span></b></p>
</div>
</div>
</div>
</body>
</html>