... | ... | @@ -42,11 +42,14 @@ This example shows the main functionality for *reading* EBAS NASA-Ames files. It |
|
|
```bash
|
|
|
./ebas_read_example.py Testdata/DE0001R.20141225000000.20160114101135.uv_abs.ozone.air.1d.1h.DE03L_UBA_We_Mon_0301.DE03L_uv_abs.lev2.nas
|
|
|
```
|
|
|
|
|
|
The script reads the input file and writes a lot of data about the file as output. See the program code (and the comments within) how things work and compare it to the output.
|
|
|
Please notice that the input file contains the ozone variable twice (in different units: ug/m3 and nmol/mol, this was generated for user convenience when the file was generated by the database). However, when reading the file, the nmol/mol varable gets automatically converted to ug/m3 as it would be stored in ebas. If you do not want this behaviour, you can specify the argument --skip_unitconvert in order to avoid this conversion. In this case you will need to use the argument --ignore_parameter as well, otherwise the paramter is rejected because of the wrong ebas unit.
|
|
|
|
|
|
```bash
|
|
|
./ebas_read_example.py Testdata/DE0001R.20141225000000.20160114101135.uv_abs.ozone.air.1d.1h.DE03L_UBA_We_Mon_0301.DE03L_uv_abs.lev2.nas --skip_unitconvert --ignore_parameter
|
|
|
```
|
|
|
|
|
|
Now, the file is read as is, no unit conversion is done, and the ozone variables in both units can be accessed.
|
|
|
|
|
|
### Generating EBAS files: ```ebas_genfile.py```
|
... | ... | @@ -58,13 +61,15 @@ This example shows how to generate a valid EBAS NASA-Ames files for data submiss |
|
|
* set variable metadata
|
|
|
* fill in variable values and flags
|
|
|
* write the file
|
|
|
``` python
|
|
|
./ebas_genfile.py```
|
|
|
```bash
|
|
|
./ebas_genfile.py
|
|
|
```
|
|
|
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.
|
|
|
|
|
|
### Convert to other file formats: ```ebas_flatcsv.py```
|
|
|
|
|
|
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
|
|
|
./ebas_flatcsv.py Testdata/*.nas```
|
|
|
./ebas_flatcsv.py Testdata/*.nas
|
|
|
```
|
|
|
All files in the Examples directory are read and the data are written to one flat csv file called 'output.csv'. |