Blame view

converter/usage.md 3.44 KB
dd534f05   Nathanael Jourdane   Improve documenta...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# NetCDF to CDF converter for AMDADB

- File: [./converter/nc2cdf.py](./converter/nc2cdf.py)
- Python interpreter: 2.7 or 3.6

## Converting a Net-CDF file

### Without output path:

Convert a NetCDF file and save the CDF file in a temp directory, then display its path:

**CLI usage**

```bash
./converter/nc2cdf.py <input_netcdf_file>
```

**Python usage**

```python
from nc2cdf import NetCdf
netcdf = NetCdf('<input_netcdf_file>')
netcdf.get_cdf()
print('CDF path: ' + netcdf.get_cdf_path())
```

- `<input_netcdf_file>`: the NetCDF file you want to convert to CDF (can be a gzip archive containing the CDF file).

> Working example:
> 
> ```bash
> ./converter/nc2cdf.py examples/skr151150000.nc.gz
> File stored in "/tmp/skr151150000.cdf".
> ```

### With output path

Convert a Net-CDF file and save the CDF file it in the specified path:

**CLI usage**

```bash
./nc2cdf.py <input_netcdf_file> <output_cdf_file>
```

**Python usage**

```python
from nc2cdf import NetCdf
netcdf = NetCdf('<input_netcdf_file>')
netcdf.get_cdf('<output_cdf_file>')
```

- `<input_netcdf_file>`: the NetCDF file you want to convert (can be a gzip archive containing the CDF file);
- `<output_cdf_file>`: the path where you want to save the CDF file.

> Working example:
> 
> ```bash
> ./converter/nc2cdf.py examples/skr151150000.nc.gz ./skr151150000.ncf
> ```

## Describing a NetCDf file

Display information about a Net-CDF file, such as global attributes and variables information:

**CLI usage**

```bash
./nc2cdf.py -i <input_netcdf_file>
```

**Python usage**

```python
from nc2cdf import NetCdf
netcdf = NetCdf('<input_netcdf_file>')
netcdf.describe()
```

- `<input_netcdf_file>`: the NetCDF file you want to display (can be a gzip archive containing the CDF file).

> Working example:
> 
> ```bash
> ./converter/nc2cdf.py -i examples/skr151150000.nc.gz
> == Time ==
>   - numpy type: |S1 ^ 2 
>   - dimension(s): Time, TimeLength
>   - size: 481x17 = 8177
> == Received ==
>   - numpy type: float32 ^ 2 
>   - dimension(s): Time, Data
>   - size: 481x4 = 1924
>   - Attributes:
>       - Order: RH 100-400kHz;  LH 100-400kHz; RH 10-1000kHz;  RH 10-1000kHz
>       - Units: W/m^2
> == Emitted ==
>   - numpy type: float32 ^ 2 
>   - dimension(s): Time, Data
>   - size: 481x4 = 1924
>   - Attributes:
>       - Order: RH 100-400kHz;  LH 100-400kHz; RH 10-1000kHz;  RH 10-1000kHz
>       - Units: W/sr
> == RH ==
>   - numpy type: float32 ^ 2 
>   - dimension(s): Time, Spec
>   - size: 481x48 = 23088
>   - Attributes:
>       - Units: W/m^2/Hz
> == VR ==
>   - numpy type: float32 ^ 2 
>   - dimension(s): Time, Spec
>   - size: 481x48 = 23088
>   - Attributes:
>       - desc: circular polarization degree; valid range: -1.1 - -0.2
> == LH ==
>   - numpy type: float32 ^ 2 
>   - dimension(s): Time, Spec
>   - size: 481x48 = 23088
>   - Attributes:
>       - Units: W/m^2/Hz
> == VL ==
>   - numpy type: float32 ^ 2 
>   - dimension(s): Time, Spec
>   - size: 481x48 = 23088
>   - Attributes:
>       - desc: circular polarization degree; valid range: -1.1 - -0.2
> == StartTime ==
>   - numpy type: |S1 ^ 1 
>   - dimension(s): TimeLength
>   - size: 17 = 17
>   - values: '2015115000000000', ...
> == StopTime ==
>   - numpy type: |S1 ^ 1 
>   - dimension(s): TimeLength
>   - size: 17 = 17
>   - values: '2015115235959000', ...
> == Global attributes ==
>   - Source: http://www.lesia.obspm.fr/kronos/ 
>   - note: Only fluxes and powers with |V| > 0.2 are taken into account
>   - Created: Wed Jul 22 11:09:30 2015
> ```