[ncl-talk] Why ncl report such error during write a simple variable into netcdf file?

林祥 xianglin72 at icloud.com
Wed Feb 8 18:06:24 MST 2017


Hi, all

    I want to output the result of SVD for SLP and SIC, but met some puzzling error as below :

fatal:Dimension sizes of left hand side do not match right hand side
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 214 in file svd_sic_slp_season.ncl    


and here below is some part of my scripts

   system("rm -f " + output_filename + ".nc")   ; remove any pre-existing file
       ncdf = addfile(output_filename+".nc","c")  ; open output netCDF file

    ;===================================================================
    ; create global attributes of the file (optional)
    ;===================================================================
       fAtt               = True            ; assign file attributes
      ; fAtt at title         = "NSIDC Bootstrap sea ice concentration"
       ;fAtt at source_file   =  "original-file.nc"
       ;fAtt at Conventions   = "None"
       fAtt at creation_date = systemfunc ("date")
       fileattdef( ncdf, fAtt )            ; copy file attributes
    ;===================================================================
    ; make time an UNLIMITED dimension; recommended  for most applications
    ;===================================================================
       filedimdef(ncdf,"time",-1,True) 
    ;===================================================================
    ; output variables directly; NCL will call appropriate functions
    ; to write the meta data associated with each variable
    ;===================================================================
       ncdf->svd_slp_season  = svd_slp_season
212  printVarSummary(svd_slp_season)
213   printVarSummary(svd_sst_season)
214  ncdf->svd_sst_season  = svd_sst_season                   ; error occurred at or near this line
        ncdf->ts_slp_season  = ts_slp_season
        ncdf->ts_sst_season  = ts_sst_season


and here below is the information from printVarSummary in line 213 and 212 
Variable: svd_slp_season
Type: float
Total Size: 87552 bytes
            21888 values
Number of Dimensions: 4
Dimensions and sizes:	[season | 4] x [nsvd | 2] x [lat | 19] x [lon | 144]
Coordinates: 
            lat: [-90..-45]
            lon: [ 0..357.5]
Number Of Attributes: 1
  _FillValue :	9.96921e+36

Variable: svd_sst_season
Type: float
Total Size: 403200 bytes
            100800 values
Number of Dimensions: 4
Dimensions and sizes:	[season | 4] x [nsvd | 2] x [lat | 35] x [lon | 360]
Coordinates: 
            lat: [-45.5..-79.5]
            lon: [0.5..359.5]
Number Of Attributes: 1
  _FillValue :	-1e+30


I am puzzled why the error occurred in writing “svd_sst_season”.

The whole script was also attached and SLP data is from NCEP monthly reanalysis.derived and SIC is 
from HadISST2.2 (http://www.metoffice.gov.uk/hadobs/hadisst2/data/download.html <http://www.metoffice.gov.uk/hadobs/hadisst2/data/download.html>)

Thank


Lin



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170209/eb9afdfa/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: svd_sic_slp_season.ncl
Type: application/octet-stream
Size: 7445 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170209/eb9afdfa/attachment.obj 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170209/eb9afdfa/attachment-0001.html 


More information about the ncl-talk mailing list