Menu

ncap2 error

Help
2016-07-10
2016-07-12
  • Alexandra Lv

    Alexandra Lv - 2016-07-10

    I'm new to nco, and I need some help here.
    I got this error when trying to add 109 to every variable "YEAR" in the file and then output:

    $ncap2 -O -h -4 -s 'YEAR2=YEAR+109' NPPLAI_b1.nc out_test_1.nc
    nco_err_exit(): ERROR Short NCO-generated message (usually name of function that triggered error): nco_enddef()
    nco_err_exit(): ERROR Error code is -101. Translation into English with nc_strerror(-101) is "HDF error"
    nco_err_exit(): ERROR NCO will now exit with system call exit(EXIT_FAILURE)

    I'm using nco/4.4.6_intel-13.1.1.163 and netcdf/4.1.1_intel-13.1.1.163_hdf5-1.8.7 on the unix cluster.

     
  • Charlie Zender

    Charlie Zender - 2016-07-11

    What happens when you try it with classic (netCDF3) output?
    ncap2 -O -h -3 -s 'YEAR2=YEAR+109' NPPLAI_b1.nc out_test_1.nc

     
    • Alexandra Lv

      Alexandra Lv - 2016-07-11

      Thanks Prof. Zender.

      I think it sort of works since I'm not getting any error message and the ncdump command shows a correct header file. But I do notice that the output file doesn't have the same length as the original input file as I expected:

      $wc -l out_test_1.nc
      59520462 out_test_1.nc
      $wc -l NPPLAI_b1.nc
      59520915 NPPLAI_b1.nc

      Is this normal?

      Then I temporarily ignored this issue and went on with making YEAR 109 years bigger with:

      ncks -O -h -x -v YEAR out_test_1.nc out_test_1.nc
      ncrename -O -h -v YEAR2,YEAR out_test_1.nc

      And I got one more error:

      nco_err_exit(): ERROR Short NCO-generated message (usually name of function that triggered error): nco_rename_var()
      nco_err_exit(): ERROR Error code is -42. Translation into English with nc_strerror(-42) is "NetCDF: String match to name in use"
      nco_err_exit(): ERROR NCO will now exit with system call exit(EXIT_FAILURE)

      It says "String match to name in use", but this is exactly what I'm tring to do, replacing YEAR with YEAR2. How should I go around with it?

       
  • Charlie Zender

    Charlie Zender - 2016-07-11

    try it all at one time with
    ncap2 -O -h -3 -s 'YEAR+=109' NPPLAI_b1.nc out_test_1.nc

     
    • Alexandra Lv

      Alexandra Lv - 2016-07-12

      YES, it works. Thank you.

       

Log in to post a comment.