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

Dennis Shea shea at ucar.edu
Wed Feb 8 20:00:48 MST 2017


Variable: svd_slp_season
Dimensions and sizes: [season | 4] x [nsvd | 2] x [lat | 19] x [lon | 144]
Coordinates:
            lat: [-90..-45]
            lon: [ 0..357.5]

Variable: svd_sst_season
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]

The 1st variable

ncdf->svd_slp_season  = svd_slp_season

wrote the lat and lon as size 19 and 144
   lat(lat)   ; lat(19)
   lon(lon)   ; lon(144)
-----
The 2nd write tried to write lat and lon as sizes 35 and 360

ncdf->svd_sst_season  = svd_sst_season
   lat(lat)   ; lat(35)
   lon(lon)   ; lon(360)

You can not have it both ways.

Maybe rename the 2nd set as:

    LAT(LAT)
    LON(LON)

On Wed, Feb 8, 2017 at 6:06 PM, 林祥 <xianglin72 at icloud.com> wrote:

> 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)
>
> Thank
>
>
> Lin
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> 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/20170208/e74813c5/attachment.html 


More information about the ncl-talk mailing list