NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

Re: [netcdfgroup] ncap2 cannot find file

  • Subject: Re: [netcdfgroup] ncap2 cannot find file
  • From: Sourish Basu <Sourish.Basu@xxxxxxxxxxxx>
  • Date: Mon, 25 Mar 2019 15:27:30 -0600
Ah, ok. I will close the bug report. Any idea why ncap2 cannot write
into an existing netcdf-4 file? Adding variables to an existing file is
a rather nice functionality!

On 3/25/19 3:22 PM, Dave Allured - NOAA Affiliate wrote:
> Sourish,
>
> It turns out this is merely a usage problem.  Your original ncap2
> command is missing an output file name, where one is required in this
> scenario.  Ncap2 is not allowed to add a new variable to the input
> file, if the format is netcdf4.  Please see the third paragraph in
> ncap2 documentation on line.
>
> I was misled by inaccurate error messages from your older version of
> ncap2.  Sorry about the extra noise about alternate causes.  It is
> ironic that the latest ncap2 version 4.7.9 on my system gives a
> perfect diagnosis:
>
> > ncap2 -L 6 -4 -h -A -sncap2 -L 6 -4 -h -A -s
> 'co2_flux_natural=3Dbio_flux_opt+fire_flux_imp+ocn_flux_opt'
> guineapig.nc
> <http://secure-web.cisco.com/10RlVLKLa7G956P7rbaD_dY1gBsiFnKg6fENIGjYr5pP2AdhDv4CF1nXLXqvu49OknGXL4CP8noBos5kefl_M3EZ1jg8A8fZzV5I1wa18xe_3aKf_1wx6zmp_6xVr2Wddg8qiEvPy341j7gecmiNgQtXz_CbdqjKIarLXLIRsCfz_mh0qB_VMgYWV7D-sQC1VbXkJybsTwdslLOETmKFiTmYf1QuqEn-143Wx78yzRYbHrmKUZVhxm69W-uAsfnro576aZvJeBEbequ9BudKgBEAvJNkKE6xNGC2bKAFttejq7R8BPRFlNvmGNTHDwL5hD6H3KCHxnBzYH52UMI-QrplAwYHF6914-urhLIndTG-LNxtzw_k-pQFAGEl1i6J9QEKgXinQdHaOC00UVSPZb-LWQZKui2eUKXaABWxwhhNt-9ggnUEAhit18niHb_8q/http%3A%2F%2Fguineapig.nc>
>
>
> ncap2: ERROR No output file specified with netCDF4 input file. When no
> output file is specified, ncap2 tries to write directly to the input
> file but this can only work with netCDF3 not netCDF4 input files.
> Please specify an output file distinct from the input file and re-try.
>
> I think you can close the NCO bug report.
>
> --Dave
>
>
> On Mon, Mar 25, 2019 at 2:48 PM Sourish Basu
> <Sourish.Basu@xxxxxxxxxxxx <mailto:Sourish.Basu@xxxxxxxxxxxx>> wrote:
>
>     Charlie,
>
>     I've narrowed down the exact problem. It seems that ncap2 can
>     append to
>     an uncompressed file, or write a compressed variable to a new
>     file, but
>     cannot append to a file with compressed variables. I've filed a bug
>     report with details at https://sourceforge.net/p/nco/bugs/111/.
>
>     -Sourish
>
>     On 3/25/19 8:31 AM, Charlie Zender wrote:
>     > Souresh,
>     >
>     > See http://nco.sf.net#help for NCO issues.
>     >
>     > FWIW, this command works fine for me with your file:
>     >
>     > ncap2 -L 6 -4 -h -A -s
>     > 'co2_flux_natural=bio_flux_opt+fire_flux_imp+ocn_flux_opt'
>     > guineapig.nc
>     
> <http://secure-web.cisco.com/10RlVLKLa7G956P7rbaD_dY1gBsiFnKg6fENIGjYr5pP2AdhDv4CF1nXLXqvu49OknGXL4CP8noBos5kefl_M3EZ1jg8A8fZzV5I1wa18xe_3aKf_1wx6zmp_6xVr2Wddg8qiEvPy341j7gecmiNgQtXz_CbdqjKIarLXLIRsCfz_mh0qB_VMgYWV7D-sQC1VbXkJybsTwdslLOETmKFiTmYf1QuqEn-143Wx78yzRYbHrmKUZVhxm69W-uAsfnro576aZvJeBEbequ9BudKgBEAvJNkKE6xNGC2bKAFttejq7R8BPRFlNvmGNTHDwL5hD6H3KCHxnBzYH52UMI-QrplAwYHF6914-urhLIndTG-LNxtzw_k-pQFAGEl1i6J9QEKgXinQdHaOC00UVSPZb-LWQZKui2eUKXaABWxwhhNt-9ggnUEAhit18niHb_8q/http%3A%2F%2Fguineapig.nc>
>     foo.nc
>     
> <http://secure-web.cisco.com/1I1txVKr87Y-cESVTbOceougUk_I-uEvchMq-XjuTgkzLVkmNmHRdBXGUcWIBI-l3vueaCg0QfsTmctDAWMyOl7amZZVLVAsrBkxB-tEdQ7GziH7ruBuo0DdBK_eiTkrNlec4xZZP5GuP1k4E6Ow64OcipXTJvxPS_uIOggvo1dZJbFcB89x9X2_5kcFrKQWkNqTcwryaUiFYY4_DCXRhBdBpDFfuCT0QdWYsjBl6a_fCoTh3tpJXpmLrSH0w0vgEHeP1GtbfhdJ6ANQYie5qhbu12YMFHl-0XSBdNYmSu2ugeW8b85X-g4Cs1EUpBmxT1SemO1shx1QlIvIwQpu-wNQnTlIq7tH3fZ6USWlt-cr9ixcMDFTW1QfBJ1z4SOBOgSi4xL--SmDu9aBdZ5H2rgSDGvF7gNkUWpuXDY32q-oSEUWzuHR06c9m72Wuu2lc/http%3A%2F%2Ffoo.nc>
>     >
>     > The -A is superfluous, and perhaps you omitted the output filename.
>     > If not, please move this thread to the site above.
>     >
>     > Charlie
>

Attachment: signature.asc
Description: OpenPGP digital signature