I need to generate an all-zeros file as an input file for an Earth Systems model (DGVM) I'm using. I have a file with the same dimensions as the zero file. I have R and MATLAB and use a Fedora machine.

  • 2
    $\begingroup$ matlab has great documentation, have you tried googling? $\endgroup$
    – Communisty
    Sep 27, 2017 at 7:30
  • 1
    $\begingroup$ If you can do it in Python, it is very easy by using e.g xarray. $\endgroup$
    – user2821
    Sep 27, 2017 at 10:17
  • 1
    $\begingroup$ Also this might be more suitable to another SE cite. $\endgroup$
    – Communisty
    Sep 27, 2017 at 12:08
  • 2
    $\begingroup$ If you have a file to begin with, you can open it up and set the variables equal to zero. I suggest NCL, but there are a variety of programs you could use. In general, it's easier to read/write an ncf file rather than creating one from scratch. $\endgroup$
    – f.thorpe
    Sep 27, 2017 at 14:51
  • 1
    $\begingroup$ If you have an example file, just use the NCO tools, which you may well already have installed: e.g., ncap2 -v -s 'zeros=foo*0.0' input.nc output.nc. $\endgroup$
    – Deditos
    Sep 28, 2017 at 11:14


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.