<p>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.</p>

CC BY-SA 3.0
2017-09-27T07:30:05.297Z
matlab has great documentation, have you tried googling?
Communisty
CC BY-SA 3.0
2017-09-27T10:17:22.170Z
If you can do it in Python, it is very easy by using e.g [xarray](http://xarray.pydata.org/en/stable/).
user2821
CC BY-SA 3.0
2017-09-27T12:08:29.330Z
Also this might be more suitable to another SE cite.
Communisty
CC BY-SA 3.0
2017-09-27T14:51:50.550Z
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.
f.thorpe
CC BY-SA 3.0
2017-09-28T11:14:17.633Z
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`.
Deditos
<matlab><netcdf>
Generating netCDF file composed of zeros?
canopyman
# Generating netCDF file composed of zeros?

(Asked by: username_0 on 2017-09-27)

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.

**Tags:** matlab, netcdf

> **Comments:**
> **username_1**: matlab has great documentation, have you tried googling?  
> **username_2**: If you can do it in Python, it is very easy by using e.g [xarray](http://xarray.pydata.org/en/stable/).  
> **username_1**: Also this might be more suitable to another SE cite.  
> **username_3**: 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.  
> **username_4**: 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`.  

---

## 0 answers

