Re: [netcdfgroup] ncgen: include binary data?

The entire point of ncgen is to process text files, so I'm not sure this is
the way to go.

Have you tried Python, specifically the xarray package? It makes this kind
of thing pretty darn easy.

http://xarray.pydata.org/en/stable/

And my "gridded" package could be very helpful here too (though it's a bit
buggy on the writing files end at this point).

https://github.com/NOAA-ORR-ERD/gridded

I'm also a bit surprised that GrADS doesn't provide a way to export /
translate to netCDF.

-CHB



On Mon, Oct 5, 2020 at 8:01 AM Ryo Furue <ryofurue@xxxxxxxxx> wrote:

> Hi netCDF group,
>
> I was wondering if the developers would consider enhancing ncgen to allow
> for binary data?
>
> Currently, ncgen accepts only ASCII data:
>
>     data:
>      VAR = 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, . . .
>
> I thought it would be nice if the format allowed for an external binary
> file in such a way as
>
> data:
>   VAR: file("path/to/mydata.bin", stream, big_endian)
>
>
> [I don't claim this is the best syntax.  This is just for illustration of
> the idea.]
>
> I'm trying to find a tool with which it's easy to convert a stream-binary
> file into a netCDF format.  Then, it struck me: Why, ncgen must be the best
> tool!
>
> So for, Ferret comes close, but it doesn't allow for large binary files
> and the Ferret language takes a bit getting used to.
>
> I'm aware of tools that can convert a pair of a GrADS control file and a
> stream binary into a netCDF file, but they can handle only single-precision
> floats.
>
> I know that you can write a C or Fortran program to do that, but using the
> C and Fortran API is too much work (dim-IDs, var-IDs, put_att, enddef,
> NF_FLOAT, etc. etc.), compared to the simplicity of the CDL format or the
> GrADS control file format.
>
> <netcdfgroup@xxxxxxxxxxxxxxxx>I think this is the very reason very few
> scientists around me write programs to generate netCDF files.  Most of them
> simply use GrADS with stream binary files because it's so easy to write
> GrADS control files.
>
> If you can use the CDL+ncgen combination to generate a netCDF file, I'd be
> able to convince them to switch to the netCDF format.
>
> Best regards,
> Ryo
>
> _______________________________________________
> NOTE: All exchanges posted to Unidata maintained email lists are
> recorded in the Unidata inquiry tracking system and made publicly
> available through the web.  Users who post to any of the lists we
> maintain are reminded to remove any personal information that they
> do not want to be made public.
>
>
> netcdfgroup mailing list
> netcdfgroup@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe,  visit:
> https://www.unidata.ucar.edu/mailing_lists/
>


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@xxxxxxxx
  • 2020 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: