[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
Fri Mar 29 09:52:53 MDT 2019


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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190329/5da54eb8/attachment.html>


More information about the ncl-talk mailing list