;============================================================= ; https://www.ncl.ucar.edu/Applications/method_1.shtml ;============================================================= ; create inline array; expand to your needs plev_bnds = (/ (/ 100000, 98750/) \ , (/ 98750, 96250/) \ , (/ 91250, 88750/) \ , (/ 1000, 500/) /)*1d0 ; name dimensions using NCL syntax plev_bnds!0 = "bnds0" plev_bnds!1 = "bnds1" plev_bnds@long_name = "lower and upper bounds" plev_bnds@units = "Pa" printVarSummary(plev_bnds) dirNc = "./" filNc = "plev_bnds.nc" pthNc = dirNc+filNc system("/bin/rm -f "+pthNc) ; remove any pre-existing file ncdf = addfile(pthNc ,"c") ; open output netCDF file ;=================================================================== ; create global attributes of the file (optional) ;=================================================================== fAtt = True ; assign file attributes fAtt@title = "plev bound file" fAtt@Conventions = "None" fAtt@creation_date = systemfunc ("date") fileattdef( ncdf, fAtt ) ; copy file attributes ;=================================================================== ; Write to file ;=================================================================== ncdf->plev_bnds = plev_bnds