Project

General

Profile

Editing NetCDF files

Added by Francis Rayder about 10 years ago

This is not a question about CDO, but since many of the users here work with NetCDF files, maybe someone can help me.

I am looking for a program with a graphical user interface that allows me to edit data in NetCDF files. I need to create land sea masks, topography data etc. in NetCDF format from scrath for some paleoclimate simulations, and for this I would ideally need a quick and easy way to edit data in NetCDF files. Does anyone know such a program he / she can recommend?

I can use a Windows platform or Linux, so either would be okay.


Replies (6)

RE: Editing NetCDF files - Added by Etienne Tourigny about 10 years ago

I have heard that Matlab can do that, but it's cost is rather high...

RE: Editing NetCDF files - Added by Francis Rayder about 10 years ago

Thanks. Unfortunately, I don't have access to Matlab.

I guess I'll have to convert the .nc files to text using ncdump, edit them by hand, and then convert them back to .nc .

RE: Editing NetCDF files - Added by Sagar Parajuli about 10 years ago

I don't understand your question correctly. You can edit the netcdf files using CDO. After editing the files, you can always visualize using grads software:
http://iges.org/grads/

RE: Editing NetCDF files - Added by Etienne Tourigny about 10 years ago

it's not terribly great, but you can try using setclonlatbox

RE: Editing NetCDF files - Added by Francis Rayder about 10 years ago

"I don't understand your question correctly. You can edit the netcdf files using CDO."

Yes, but it is extremely tedious to edit fields one by one using commands like setclonlatbox, then changing the value of each field, and so on.

Since I am trying to make elevation maps and such for paleoclimate experiments, I had hoped that someone would know a quicker way, maybe a GUI editor for netcdf files. But apparently, that does not exist.

RE: Editing NetCDF files - Added by Ralf Mueller about 10 years ago

I've an idea, but it requires some programming and only works, if your output grid is lonlat:

  1. Create an image with something like gimp or any other drawing tool with your target grid points
  2. Draw the land sea mask by hand by hand in monochrome - others like topography could be copied from the finished land-sea-mask and been further edit to keep it coherent with the lsm file
  3. Use some scripting language package to read-in the pixel field as a multi-dimensional arrays of let's say floats. Python together with the numpy/scipy library can to this. For ruby, there is rmagick.
  4. After this step, the data is available as a numpy (python) or narray (ruby). Both classes offer a rich set of methods to set values to your needs.
  5. Create a netcdf file with numpy or python-netcdf4 (python) of ruby-netcdf (ruby) and write the data array to the file. If you attend to the CF-convention regarding dimension names or units, you'll be able to work on the files with CDO.

hth
ralf

    (1-6/6)