usage.md 3.44 KB

NetCDF to CDF converter for AMDADB

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

./converter/nc2cdf.py <input_netcdf_file>

Python usage

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:

./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

./nc2cdf.py <input_netcdf_file> <output_cdf_file>

Python usage

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:

./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

./nc2cdf.py -i <input_netcdf_file>

Python usage

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:

./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