... | ... | @@ -34,6 +34,8 @@ pip uninstall ebas-io |
|
|
## Examples
|
|
|
Example scripts and test data can be found in the downloaded tarball in the directory 'Examples'.
|
|
|
|
|
|
> Most examples support the ```--help``` (or ```-h```) option on the commandline which gives a short explanation of the script and the commandline arguments.
|
|
|
|
|
|
### Reading EBAS files: ```ebas_read_example.py```
|
|
|
|
|
|
This example shows the main functionality for *reading* EBAS NASA-Ames files. It demonstrates how to:
|
... | ... | @@ -72,7 +74,36 @@ This example shows how to generate a valid EBAS NASA-Ames files for data submiss |
|
|
```
|
|
|
will create an output file named ```NO0042G.20140101110000.20150213125421.passive_puf..air.11mo.3mo.NO01L_puf_42.NO01L_gc_ms.lev2.nas```. Read the program code and discover how the file is generated.
|
|
|
|
|
|
### Reformat an EBAS Nasa Ames File: ```ebas_reforat.py```
|
|
|
This script reads an EBAS Nasa Ames File and writes it again. In between, the format is standardised automatically by the ebas-io module:
|
|
|
* The order of the metadata elements is standardised
|
|
|
* The occurrence of metadata elements in the file global metadata vs. varable metadata is optimized
|
|
|
* Variables are sorted
|
|
|
* Flag columns are optimised
|
|
|
* Number of digits used for flags is minimised
|
|
|
* Number format and missing values are optimised according to actual data
|
|
|
* The filename is standardised
|
|
|
* ...
|
|
|
The tool can be used to reformat badly formatted files generated manually or by other tools into a reproducible standard representation. The source file must be readable (not syntax errors)
|
|
|
```bash
|
|
|
./ebas_reformat.py Testdata/ugly_file
|
|
|
```
|
|
|
Produces a standardized output file in the current directory, the filename is according to the EBAS file name convention.
|
|
|
|
|
|
### File format conversion: ```ebas_convert.py```
|
|
|
This script converts from EBAS Nasa Ames to other export formats supported by EBAS (use ```ebas_convert.py --help``` for alist of formats). There are some additional features, like:
|
|
|
* ignore certain errors in the source file
|
|
|
* skip some variables
|
|
|
* change the flag output style
|
|
|
When using ```--format NasaAmes```, the script does about the same as the ebas_reformat example above.
|
|
|
```bash
|
|
|
./ebas_convert.py Testdata/*.nas --format CSV --createfiles
|
|
|
```
|
|
|
Converts all the .nas files in the Testdata directory to .csv format and creates the output files in the current directory.
|
|
|
|
|
|
|
|
|
### Convert to other file formats: ```ebas_flatcsv.py```
|
|
|
This shows that new export formats can easily be implemented by a user. One is not limited by the supported export formats in EBAS.
|
|
|
|
|
|
This example originates from a data user's request whether we could deliver EBAS data in a different file format. He wanted to have a simple, flat, highly redundant csv format for easy ingestion of the data into his software. We came up with this short script and he was able to convert the EBAS NASA-Ames files we delivered by himself. No new data format to maintain for us, full control of the interface for the data user.
|
|
|
```bash
|
... | ... | @@ -80,6 +111,7 @@ This example originates from a data user's request whether we could deliver EBAS |
|
|
```
|
|
|
All files in the Examples directory are read and the data are written to one flat csv file called 'output.csv'.
|
|
|
|
|
|
|
|
|
## More Documentation
|
|
|
|
|
|
### EBAS Metadata tags and the keys to be used in the IO object
|
... | ... | |