[ncl-talk] NCL ERROR: Right hand side has no coordinate variable can not delete coordinate variable of a file

Dennis Shea shea at ucar.edu
Wed Mar 15 15:46:52 MDT 2017


In my opinion the warning can be ignored.
-----------------------------------------------
You are using the 'simple' method of creating netCDF

This method takes advantage of the fact that in NCL a variable is an
internal data structure that is based upon the netCDF data model. The data
structure has an array of values; string information such as long_name and
units and, often, coordinate information such as  time, level, lat, lon

When you did:

  i3d_TT = new((/26,192,288/),"float")
  i3d_TT!0 = "lev_p"
  i3d_TT!1 = "lat"
  i3d_TT!2 = "lon"
  i3d_TT at units = "K"
  i3d_TT at long_name = "CAM temperature"

you *named* the dimension
...BUT...
you did not associate any coordinate values with the named dimension

You need:

   i3d_TT&lat = lat      ; associate values with the named dimension
   i3d_TT&lon = lon
   i3d_TT&lev_p - lev_p

Then do *only*

ncdf = addfile(odir+"netcdf/CAM_"+date+".nc","c")

  ncdf->TT = i3d_TT

 NCL software will write out all meta data.

Good luck

On Wed, Mar 15, 2017 at 8:59 AM, Bian Qingyun <bianqy at tea.ac.cn> wrote:

>
> Hi,
>
> I met the following problem when running NCL. Although this warning
> exists, it seems the script still works. Could I ignore this warning? Or
> it's a serious problem? If so, how to fix it? Any suggestions are
> appreciated!
>
> --------------------------------------
>
> warning:Right hand side has no coordinate variable can not delete
> coordinate variable of a file, use (/ .. /) to avoid this message
> warning:Right hand side has no coordinate variable can not delete
> coordinate variable of a file, use (/ .. /) to avoid this message
> warning:["Execute.c":8575]:Execute: Error occurred at or near line 475 in
> file CAM_netcdf_to_GRIB.ncl
>
> --------------------------------------
>
> My ncl version is ncl_ncarg/6.3.0 on SUSE Linux Enterprise Server 11
> (x86_64).
>
> Followed is an extract of my script* (the red part is where the warning
> occurred):*
>
> begin
>
> ; Main input parameters:
> ;************************************************************************
>   ;directory containing individual time step data
>   cdir = "./ind/"
>   ;directory to contain grib files
>   odir = "./output/"
>   ;file names of each model, not including the date
>   mod1 = "cam_CESM_hist_"
>   pnew = (/1000.0,975.0,950.0,925.0,900.0,850.0,\
>             800.0,750.0,700.0,650.0,600.0,\
>             550.0,500.0,450.0,400.0,350.0,300.0,250.0,\
>             200.0,150.0,100.0,70.0,\
>              50.0,30.0,20.0,10.0/)
>
> ; Open data
> ;************************************************************************
>   files = systemfunc("ls "+cdir+mod1+syr+smo+"*.nc")
>   netcdf_cam_filenames = addfiles(files,"r")
>   ;get the number of files for do loop below
>   numfil = dimsizes(files) - 1
>   delete(files)
>
> ; Begin loop over daily files in the month
> ;************************************************************************
>   do f=0, numfil
>   netcdf_cam_filename = netcdf_cam_filenames[f]
>
> ;************************************************************************
>   ;CAM
>   lat = netcdf_cam_filename->lat
>   lon = netcdf_cam_filename->lon
>   time = netcdf_cam_filename->time
>   lev = netcdf_cam_filename->lev
>   date = netcdf_cam_filename->date
>   date_to_str = tostring(date)
>   dtime_map = (/4,2,2/)
>   st_dtime = str_split_by_length(date_to_str, dtime_map)
>   YYYY = st_dtime(0)
>   MM = st_dtime(1)
>   DD = st_dtime(2)
>   nlon = netcdf_cam_filename->nlon
>   P0 = netcdf_cam_filename->P0
>   hyam = netcdf_cam_filename->hyam
>   hybm = netcdf_cam_filename->hybm
>   PS = netcdf_cam_filename->PS(0,:,:)
>   T = netcdf_cam_filename->T(0,:,:,:)
>
>   delete(netcdf_cam_filename)
>
>   lat at units = "degrees_north"
>   lat at long_name = "latitude"
>   lon at units = "degrees_east"
>   lon at long_name = "longitude"
>
>   i3d_TT = new((/26,192,288/),"float")
>   i3d_TT!0 = "lev_p"
>   i3d_TT!1 = "lat"
>   i3d_TT!2 = "lon"
>   i3d_TT at units = "K"
>   i3d_TT at long_name = "CAM temperature"
>
>   print("Interpolating 3-d variables to pressure levels...")
>   P0 = P0/100. ;vinth2p wants P0 in hpa
>   i3d_TT = vinth2p(T,hyam,hybm,pnew,PS,1,P0,2,True)
>
>   delete([/T,PS/])
>
> ;Writing fields to NetCDF...
> ;*************************************************************************
>  ;open a new file
>   ncdf = addfile(odir+"netcdf/CAM_"+date+".nc","c")
>
>   print("Writing fields to NetCDF...")
>  ;output variables   ------ only  CAM output
>   ncdf->lat = lat
>   ncdf->lon = lon
>   ncdf->TT = i3d_TT
>
>   ;Clean up
>   delete([/ncdf,i3d_TT/])
>
>   ;daily loop
>   end do
>
> end
>
>
> -----
>
> Thank you very much!
>
> Best,
>
> Qingyun
>
>
>
>
>
>
> _______________________________________________
> 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/20170315/d4fc1528/attachment.html 


More information about the ncl-talk mailing list