[netcdf-java] Removing a dimension from a variable


I am subsetting an opendap nc file to a local nc file and I¹m running into a
bit of a problem.  After subsetting, the variable of interest has 4
dimensions (x, y, level, record) however there is only 1 level.  I would
like to remove the level dimension as it is unnecessary and causes some
problems later in the application.  Is there a way to do this?  I¹ve tried
removing the dimension from the ³root group² of the NetcdfWritable file with
no luck.  I¹ve also tried iterating through the dimensions
(var.getDimensions().remove(i)) and removing the one with length = 1, also
no luck.

Has anyone done this before?  Is it possible, or do I need to extract the
data, reduce the resulting array, and then recreate the variable by hand?

Any help is most appreciated,



Christopher Mueller | Scientist
Applied Science Associates
70 Dean Knauss Drive | Narragansett, RI 02882 USA
p: +1 401-789-6224 | f: +1 401-789-1932
e: cmueller@xxxxxxxxxxxxxx | www.asascience.com

ASA | Science. Services. Solutions

Imagination is everything.  It is the preview of life's coming attractions.
- Albert Einstein

Whether you think you can or think you can't, either way you are right. -
Henry Ford

  • 2007 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: