[ncl-talk] an error occurred while adding a variable to a file, check to make sure data type is supported by the output format

xiaoming Hu yuanfangcan at hotmail.com
Tue Apr 2 17:43:45 MDT 2019


Dennis

  Thanks a lot!   since the dimension is not unlimited, I added an extra step to do this:

foreach file (*.nc4 )
 ncks --mk_rec_dmn sounding_id ${file} -o ${file}_Unlimited
 ncks -O -v latitude,xco2,date,longitude,xco2_quality_flag,time ${file}_Unlimited ${file}.Rain
 echo ${file}
end
ncrcat *.Rain OCO-2_9_LITE_LEVEL2_extracted_2016only.nc4

Thanks
Xiaoming
________________________________
From: Dennis Shea <shea at ucar.edu>
Sent: Friday, March 29, 2019 1:36 PM
To: xiaoming Hu
Cc: ncl-talk at ucar.edu; Xiaoming Hu
Subject: 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

netCDF Operators

%> ncrcat *nc4 FOO.nc4

or

%> ncrcat -v date,xco2,xco2_quality_flag  *nc4  FOO.nc4

 NCL


files= systemfunc("ls *.nc4")
f = addfiles(files, "r")
print(f)



On Fri, Mar 29, 2019 at 9:53 AM xiaoming Hu <yuanfangcan at hotmail.com<mailto:yuanfangcan at hotmail.com>> wrote:
I wrote a simple script (attached below) to concatenate among different files.

But I got error message in a simple line:

fout->latitude= latitude_pre

see my screen output:

"

Variable: latitude_pre
Type: float
Total Size: 2415220 bytes
            603805 values
Number of Dimensions: 1
Dimensions and sizes:   [sounding_id | 603805]
Coordinates:
            sounding_id: [2014091900023702..2014092123542735]
Number Of Attributes: 5
  comment :     center latitude of the measurement
  long_name :   latitude
  units :       degrees_north
  missing_value :       -999999
  _FillValue :  -999999
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
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 65 in file extract_overChina.ncl

(0)     finish outputing the 1st var
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
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 67 in file extract_overChina.ncl

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
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 68 in file extract_overChina.ncl

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
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 69 in file extract_overChina.ncl

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
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 70 in file extract_overChina.ncl

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
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 71 in file extract_overChina.ncl

"

Any idea what is happening?

Thanks a lot

Xiaoming

My NCl script:

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



_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190402/bc968198/attachment.html>


More information about the ncl-talk mailing list