[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #UZE-985140]: netcdf4 1.1.1 Illegal Characters



> Full Name: Aaron Scott
> Email Address: address@hidden
Hi Aaron,

> Organization: NASA Langley
> Package Version: 1.1.1
> Operating System: OSX
> Hardware:
> Description of problem: I am creating groups in a new netcdf4 file. I need 
> there to be groups within groups. Example:
> w = nc.Dataset(output_folder+'/'+granule_name[0]+"_Subset.nc","w", 
> format='NETCDF4')
> HDFEOS = w.createGroup("HDFEOS")
> SWATHS = w.createGroup("/HDFEOS/SWATH")
> 
> So, I am trying to put the "SWATH" group into the "HDFEOS" group. It is 
> throwing this error:
> 
> File 
> "/Users/akscott1/Documents/workspace/MOPITT_Python_Subsetter/python_subsetters/MOPITT_Python_Subsetter.py",
>  line 443, in hdf5subset
> SWATHS = w.createGroup("/HDFEOS/SWATH")
> File "netCDF4.pyx", line 1843, in netCDF4.Dataset.createGroup 
> (netCDF4.c:23172)
> File "netCDF4.pyx", line 2119, in netCDF4.Group.__init__ (netCDF4.c:27350)
> RuntimeError: NetCDF: Name contains illegal characters
> 
> It does not like the "/" but how else do I create the groups without the "/' 
> for the correct path?

If you are using an up-to-date netcdf4-python module and w was returned from a 
createDataset 
or createGroup call, then that should work, as this example from the docs shows:

  >>> fcstgrp1 = rootgrp.createGroup("/forecasts/model1")
  >>> fcstgrp2 = rootgrp.createGroup("/forecasts/model2")

See the docs at http://unidata.github.io/netcdf4-python/ for more info on using 
createGroup for
creating nested subgroups. If it doesn't work, it's a bug that should be 
reported on the GitHub
site by creating an "issue" here: 
  https://github.com/Unidata/netcdf4-python/issues

--Russ



Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: UZE-985140
Department: Support netCDF
Priority: Normal
Status: Closed


NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.