<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Dennis</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks a lot! since the dimension is not unlimited, I added an extra step to do this: </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span>foreach file (*.nc4 )<br>
</span>
<div> ncks --mk_rec_dmn sounding_id ${file} -o ${file}_Unlimited<br>
</div>
<div> ncks -O -v latitude,xco2,date,longitude,xco2_quality_flag,time ${file}_Unlimited ${file}.Rain<br>
</div>
<div> echo ${file}<br>
</div>
<div>end<br>
</div>
<div>ncrcat *.Rain OCO-2_9_LITE_LEVEL2_extracted_2016only.nc4<br>
</div>
<span></span><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Xiaoming </div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Dennis Shea <shea@ucar.edu><br>
<b>Sent:</b> Friday, March 29, 2019 1:36 PM<br>
<b>To:</b> xiaoming Hu<br>
<b>Cc:</b> ncl-talk@ucar.edu; Xiaoming Hu<br>
<b>Subject:</b> Re: [ncl-talk] an error occurred while adding a variable to a file, check to make sure data type is supported by the output format</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>netCDF Operators<br>
</div>
<div><br>
</div>
<div>%> <b>ncrcat</b> *nc4 FOO.nc4</div>
<div><br>
</div>
<div>or</div>
<div><br>
</div>
<div>%> <b>ncrcat</b> -v date,xco2,xco2_quality_flag *nc4 FOO.nc4</div>
<div><br>
</div>
<div> NCL</div>
<div><br>
</div>
<div>
<pre>files= <b>systemfunc</b>("ls *.nc4")<br>f = <b>addfile<span style="color:rgb(0,0,255)">s</span></b>(files, "r")<br><b>print</b>(f)<br><br><br></pre>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Fri, Mar 29, 2019 at 9:53 AM xiaoming Hu <<a href="mailto:yuanfangcan@hotmail.com">yuanfangcan@hotmail.com</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt">I wrote a simple script (attached below) to concatenate among different files. </span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<pre>But I got error message in a simple line: <pre style="background-color:rgb(255,255,255)">fout->latitude= latitude_pre </pre><pre style="background-color:rgb(255,255,255)">see my screen output:</pre><pre style="background-color:rgb(255,255,255)">"</pre><pre style="background-color:rgb(255,255,255)"><span>Variable: latitude_pre<br></span><div>Type: float<br></div><div>Total Size: 2415220 bytes<br></div><div> 603805 values<br></div><div>Number of Dimensions: 1<br></div><div>Dimensions and sizes: [sounding_id | 603805]<br></div><div>Coordinates: <br></div><div> sounding_id: [2014091900023702..2014092123542735]<br></div><div>Number Of Attributes: 5<br></div><div> comment : center latitude of the measurement<br></div><div> long_name : latitude<br></div><div> units : degrees_north<br></div><div> missing_value : -999999<br></div><div> _FillValue : -999999<br></div><div>fatal:["NclFile.c":432]:FileAddVar: an error occurred while adding a variable to a file, check to make sure data type is supported by the output format<br></div><div>fatal:["Execute.c":8578]:Execute: Error occurred at or near line 65 in file extract_overChina.ncl<br></div><div><br></div><div>(0) finish outputing the 1st var<br></div><div>fatal:["NclFile.c":432]:FileAddVar: an error occurred while adding a variable to a file, check to make sure data type is supported by the output format<br></div><div>fatal:["Execute.c":8578]:Execute: Error occurred at or near line 67 in file extract_overChina.ncl<br></div><div><br></div><div>fatal:["NclFile.c":432]:FileAddVar: an error occurred while adding a variable to a file, check to make sure data type is supported by the output format<br></div><div>fatal:["Execute.c":8578]:Execute: Error occurred at or near line 68 in file extract_overChina.ncl<br></div><div><br></div><div>fatal:["NclFile.c":432]:FileAddVar: an error occurred while adding a variable to a file, check to make sure data type is supported by the output format<br></div><div>fatal:["Execute.c":8578]:Execute: Error occurred at or near line 69 in file extract_overChina.ncl<br></div><div><br></div><div>fatal:["NclFile.c":432]:FileAddVar: an error occurred while adding a variable to a file, check to make sure data type is supported by the output format<br></div><div>fatal:["Execute.c":8578]:Execute: Error occurred at or near line 70 in file extract_overChina.ncl<br></div><div><br></div><div>fatal:["NclFile.c":432]:FileAddVar: an error occurred while adding a variable to a file, check to make sure data type is supported by the output format<br></div><div>fatal:["Execute.c":8578]:Execute: Error occurred at or near line 71 in file extract_overChina.ncl</div></pre><pre style="background-color:rgb(255,255,255)">"</pre></pre>
<pre>Any idea what is happening? </pre>
<pre>Thanks a lot</pre>
<pre>Xiaoming </pre>
<pre>My NCl script: </pre>
<pre>files= systemfunc("ls *.nc4")
do ifile = 0 , dimsizes(files)-1
f= addfile(files(ifile),"r")
print("start working on "+files(ifile))
latitude=f->latitude
xco2=f->xco2
date=f->date
longitude=f->longitude
time=f->time
xco2_quality_flag=f->xco2_quality_flag
print("having record "+dimsizes(xco2))
if (ifile.eq.0)
latitude_total =latitude
xco2_total =xco2
date_total =date
longitude_total =longitude
time_total =time
xco2_quality_flag_total=xco2_quality_flag
else
latitude_total =array_append_record (latitude_pre, latitude, 0 )
xco2_total =array_append_record (xco2_pre, xco2, 0 )
date_total =array_append_record (date_pre, date, 0 )
longitude_total =array_append_record (longitude_pre, longitude, 0 )
time_total =array_append_record (time_pre, time, 0 )
xco2_quality_flag_total =array_append_record (xco2_quality_flag_pre, xco2_quality_flag, 0 )
end if
if (ifile.gt.0) then
delete(latitude_pre); =array_append_record (latitude_pre, latitude, 0 )
delete(xco2_pre ); =array_append_record (xco2_pre, xco2, 0 )
delete(date_pre ); =array_append_record (date_pre, date, 0 )
delete(longitude_pre); =array_append_record (longitude_pre, longitude, 0 )
delete(time_pre ); =array_append_record (time_pre, time, 0 )
delete(xco2_quality_flag_pre); =array_append_record (xco2_quality_flag_pre, xco2_quality_flag, 0 )
end if
latitude_pre= latitude_total
xco2_pre= xco2_total
date_pre= date_total
longitude_pre= longitude_total
time_pre= time_total
xco2_quality_flag_pre= xco2_quality_flag_total
delete(latitude_total); =array_append_record (latitude_pre, latitude, 0 )
delete(xco2_total ); =array_append_record (xco2_pre, xco2, 0 )
delete(date_total ); =array_append_record (date_pre, date, 0 )
delete(longitude_total); =array_append_record (longitude_pre, longitude, 0 )
delete(time_total ); =array_append_record (time_pre, time, 0 )
delete(xco2_quality_flag_total); =array_append_record (xco2_quality_flag_pre, xco2_quality_flag, 0 )
delete(latitude); =array_append_record (latitude_pre, latitude, 0 )
delete(xco2 ); =array_append_record (xco2_pre, xco2, 0 )
delete(date ); =array_append_record (date_pre, date, 0 )
delete(longitude); =array_append_record (longitude_pre, longitude, 0 )
delete(time ); =array_append_record (time_pre, time, 0 )
delete(xco2_quality_flag); =array_append_record (xco2_quality_flag_pre, xco2_quality_flag, 0 )
print("finish working on "+files(ifile))
end do
system("rm OCO-2_9_LITE_LEVEL2_all.nc")
fout=addfile("OCO-2_9_LITE_LEVEL2_all.nc","c")
printVarSummary(latitude_pre)
fout->latitude= latitude_pre
print("finish outputing the 1st var")
fout->xco2= xco2_pre
fout->date= date_pre
fout->longitude= longitude_pre
fout->time= time_pre
fout->xco2_quality_flag= xco2_quality_flag_pre
</pre>
<br>
<br>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote>
</div>
</div>
</body>
</html>