# 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 ``` **Python usage** ```python from nc2cdf import NetCdf netcdf = NetCdf('') netcdf.get_cdf() print('CDF path: ' + netcdf.get_cdf_path()) ``` - ``: 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 ``` **Python usage** ```python from nc2cdf import NetCdf netcdf = NetCdf('') netcdf.get_cdf('') ``` - ``: the NetCDF file you want to convert (can be a gzip archive containing the 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 ``` **Python usage** ```python from nc2cdf import NetCdf netcdf = NetCdf('') netcdf.describe() ``` - ``: 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 > ```