rockdoc / cdlparser

A python module for parsing files encoded in netCDF's common data form language (CDL)
BSD 3-Clause "New" or "Revised" License
2 stars 4 forks source link

Add a CDL4Parser class #5

Open rockdoc opened 11 years ago

rockdoc commented 11 years ago

Adding an extra class to handle parsing of CDL files that adhere to the netCDF-4 syntax is a longer term goal. The CDL4 grammar is significantly more complex than that used in CDL3, so it's a non-trivial task.

hyoklee commented 9 years ago

Hi, I really appreciate your CDL parser effort. Is there any progress on CDL4 parser?

rockdoc commented 9 years ago

@hyoklee - Hi there. Thanks for the positive feedback on the CDL parser. I hope it's useful to you. Unfortunately I'm currently busy working on other projects so I'm unlikely to find the time to work on a CDL4 parser in the immediate short term.

randallpittman commented 5 years ago

I might like to implement the CDL4 parser. At the very least I'm hoping to use the additional data types (unsigned types, string, etc.). I'll let you know how it goes!

rockdoc commented 5 years ago

@randallpittman

I might like to implement the CDL4 parser. At the very least I'm hoping to use the additional data types (unsigned types, string, etc.). I'll let you know how it goes!

That'd be cool. Good luck with that!

randallpittman commented 5 years ago

I'm starting out by creating a CDF5Parser class (CDL5Parser? CDL-CDF5Parser?) that adds the unsigned and 64-bit types and defaults to the 'NETCDF3_64BIT_DATA' file format (different from the older NETCDF3_64BIT_DATA_OFFSET, which just allows >2GiB files). (https://www.unidata.ucar.edu/software/netcdf/docs/netcdf_introduction.html#netcdf_64bit_data_format). The super cool thing is that I can just subclass CDL3Parser and make a few changes.

hyoklee commented 5 years ago

I wrote a CDL4 parser that can handle group like below:

def t_SECTION(self, t) : r'dimensions:|DIMENSIONS:|variables:|VARIABLES:|data:|DATA:|group:|GROUP:' It's currently being used for HDF Product Deisnger to import CDL that has groups. I wish I could contribute the parser in HPD code but I'm still waiting for NASA's approval due to their open source policy.

I'm writing this note to cheer for @randallpittman's effort and remind him that group support is as important as new type support.

randallpittman commented 5 years ago

I think I've about finished the CDF-5 parser after a lot of trial and error and trying to wrap my brain around PLY. Once I've added a test I'll submit a PR for it and then start working on adding groups and strings. The variable-length types will come last as I'm least familiar with those.

Working branch for CDF5: https://github.com/randallpittman/cdlparser/tree/CDF5