metno / pyaerocom

Python tools for climate and air quality model evaluation
https://pyaerocom.readthedocs.io/
GNU General Public License v3.0
24 stars 13 forks source link

Reading HTAP EAS NetCDF fails #75

Closed jgliss closed 4 years ago

jgliss commented 4 years ago

@hannasv

just tested loading all HTAP masks using this script + output ;)

Script:

import pyaerocom as pya
pya.land_sea_mask.download_mask()
result = {}
for reg in pya.const.HTAP_REGIONS:
    try:
        pya.land_sea_mask.load_region_mask_xr(reg)
        result[reg] = 'OK'
    except OSError as e:
        result[reg] = 'FAILED: {}'.format(repr(e))

for reg, info in result.items():
    print(reg, info)

Output:

PAN OK
EAS FAILED: OSError(-51, 'NetCDF: Unknown file format')
NAF OK
MDE OK
LAND OK
SAS OK
SPO OK
OCN OK
SEA OK
RBU OK
EEUROPE OK
NAM OK
WEUROPE OK
SAF OK
USA OK
SAM OK
EUR OK
NPO OK
MCA OK

Seems all masks work but EAS. Can you reproduce? And if yes, check?

Cheers, Jonas

hannasv commented 4 years ago

Fixed this. The problem was related to EAS having a different filename ending than the other. Essentially the code was downloading a file that wasn't there and thus it was not working. I fixed this now. Might not be the most robust way to download the files. I would have expected the function to raise an error if the file is not at the url.....