Commit c628de072288c58be49d98fe986c224b61f7a2c2
1 parent
ef9a8767
Exists in
master
Small changes on converter and specs
Showing
2 changed files
with
21 additions
and
2 deletions
Show diff stats
CDF_spec.md
... | ... | @@ -280,6 +280,12 @@ To create new variables with [spacepy.pycdf)(http://pythonhosted.org/SpacePy/pyc |
280 | 280 | |
281 | 281 | To name variables, use the `NumericalData/Parameter/ParameterKey` parameter from the SPASE file. |
282 | 282 | |
283 | +### Metadata variable | |
284 | + | |
285 | +## Variable attributes | |
286 | + | |
287 | + | |
288 | + | |
283 | 289 | ### `CATDESC` |
284 | 290 | |
285 | 291 | type: CDF_CHAR | ... | ... |
nc2cdf.py
... | ... | @@ -14,10 +14,13 @@ os.environ['SPACEPY'] = '/tmp' |
14 | 14 | import netCDF4 |
15 | 15 | from spacepy import pycdf |
16 | 16 | |
17 | -AMDA_DICT_PATH = './amda.json' | |
18 | 17 | TEMP_FILE = '/tmp' |
19 | 18 | |
20 | 19 | |
20 | + | |
21 | +RESOLVER_URL = 'http://apus.irap.omp.eu:8080/amda-registry/resolver' | |
22 | + | |
23 | + | |
21 | 24 | def error(error_message, e=None): |
22 | 25 | """ Display an `error_message` and exit the program. """ |
23 | 26 | |
... | ... | @@ -140,10 +143,20 @@ class NetCdf: |
140 | 143 | |
141 | 144 | # Make the pyCDF object |
142 | 145 | try: |
143 | - return pycdf.CDF(cdf_path, '') | |
146 | + cdf = pycdf.CDF(cdf_path, '') | |
144 | 147 | except pycdf.CDFError as e: |
145 | 148 | error('Can not create CDF file on %s, check that the directory exists and its writing access' % cdf_path, e) |
146 | 149 | |
150 | + # TODO Get spase file | |
151 | + | |
152 | + get_spase() | |
153 | + | |
154 | + cdf.attrs['Acknowledgement '] = 'John Doe' | |
155 | + | |
156 | + return cdf | |
157 | + | |
158 | + def get_spase(self): | |
159 | + | |
147 | 160 | @staticmethod |
148 | 161 | def build_temp_path(path, extension): |
149 | 162 | return op.abspath(op.join(TEMP_FILE, op.basename(path).split('.')[0] + extension)) | ... | ... |