Polymer 4.11 throw "pyhdf.error.HDF4Error: SD (15): File is supported, must be either hdf, cdf, netcdf"

Post Reply
southocean
Posts: 11
Joined: Fri Jun 07, 2019 12:05 pm
company / institution: Sun Yat-Sen UNIVERSITY
Location: guangdong province China

Polymer 4.11 throw "pyhdf.error.HDF4Error: SD (15): File is supported, must be either hdf, cdf, netcdf"

Post by southocean »

Hello!
I processed landsat 8 data with Polymer 4.11. And two months ago, I can process landsat8 data successfully, but these days it throw the error as follows:

Code: Select all

Reading coordinates from /home/yanny/graduation_project/try/LC08_L1TP_012031_20171004_20171014_01_T1/LC08_L1TP_012031_20171004_20171014_01_T1_B1.TIF
Image size is 7901x8011
Traceback (most recent call last):
  File "./try_landsat8_data1.py", line 15, in <module>
    example_landsat8()
  File "./try_landsat8_data1.py", line 10, in example_landsat8
    Level1_OLI('/home/yanny/graduation_project/try/LC08_L1TP_012031_20171004_20171014_01_T1'),
  File "/home/yanny/software/old_polymer-v4.11/polymer/level1_landsat8.py", line 143, in __init__
    self.init_ancillary()
  File "/home/yanny/software/old_polymer-v4.11/polymer/level1_landsat8.py", line 155, in init_ancillary
    self.ozone = self.ancillary.get('ozone', self.date())
  File "/home/yanny/software/old_polymer-v4.11/polymer/ancillary.py", line 278, in get
    return self.read(param, res)
  File "/home/yanny/software/old_polymer-v4.11/polymer/ancillary.py", line 190, in read
    hdf = SD(filename)
  File "/home/yanny/anaconda3/lib/python3.6/site-packages/pyhdf/SD.py", line 1429, in __init__
    _checkErr('SD', id, "cannot open %s" % path)
  File "/home/yanny/anaconda3/lib/python3.6/site-packages/pyhdf/error.py", line 23, in _checkErr
    raise HDF4Error(err)
pyhdf.error.HDF4Error: SD (15): File is supported, must be either hdf, cdf, netcdf
I preprocessed the landsat8 data based on this post viewtopic.php?f=7&t=35 And I found that whether I run

Code: Select all

l8_angles LC08_..._ANG.txt BOTH 1 
or not, it throw the same error as above .
Another thing worth to say it that I can successfully run the landsat8 data which I run two months ago, so I guess it's probably not because of the environment.Can someone tell me how to solve it?

Thanks for your help in advance!
Best regards,
southocean
User avatar
fsteinmetz
Site Admin
Posts: 306
Joined: Fri Sep 07, 2018 1:34 pm
company / institution: Hygeos
Location: Lille, France
Contact:

Re: Polymer 4.11 throw "pyhdf.error.HDF4Error: SD (15): File is supported, must be either hdf, cdf, netcdf"

Post by fsteinmetz »

Hello,

Indeed, there has been a change on the access to ancillary data on NASA servers. Please see this thread :
viewtopic.php?f=7&t=50

I recommend to use Ancillary_ERA5 or modify ancillary.py as described in this thread, until I release a fix.
Cheers,
François
southocean
Posts: 11
Joined: Fri Jun 07, 2019 12:05 pm
company / institution: Sun Yat-Sen UNIVERSITY
Location: guangdong province China

Re: Polymer 4.11 throw "pyhdf.error.HDF4Error: SD (15): File is supported, must be either hdf, cdf, netcdf"

Post by southocean »

Thank you so much François!

I can run the results following your instructions.

Best regards,
southocean
southocean
Posts: 11
Joined: Fri Jun 07, 2019 12:05 pm
company / institution: Sun Yat-Sen UNIVERSITY
Location: guangdong province China

Re: Polymer 4.11 throw "pyhdf.error.HDF4Error: SD (15): File is supported, must be either hdf, cdf, netcdf"

Post by southocean »

Hello François!
After I successfully ran some landsat8 images, I face another problem just now.

Code: Select all

(base) yanny@custome:~/software/polymer-v4.12$ ./try_landsat8_data1.py                                           
Reading coordinates from /home/yanny/landsat8_data_USGS/LC08_L1TP_181030_20170902_20170916_01_T1/LC08_L1TP_181030_20170902_20170916_01_T1_B1.TIF
Image size is 7721x7841
Download 2017-09-02 08:00:00 -> ANCILLARY/ERA5/2017/09/02/era5_20170902_080000.nc
2020-02-19 18:41:38,977 INFO Welcome to the CDS
2020-02-19 18:41:38,978 INFO Sending request to https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-single-levels
Traceback (most recent call last):
  File "/home/yanny/anaconda3/lib/python3.6/site-packages/cdsapi/api.py", line 375, in _api
    result.raise_for_status()
  File "/home/yanny/anaconda3/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error:  for url: https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-single-levels

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./try_landsat8_data1.py", line 16, in <module>
    example_landsat8()
  File "./try_landsat8_data1.py", line 11, in example_landsat8
    Level1_OLI('/home/yanny/graduation_project/landsat8_data_USGS/LC08_L1TP_181030_20170902_20170916_01_T1', ancillary=Ancillary_ERA5()),
  File "/home/yanny/software/polymer-v4.12/polymer/level1_landsat8.py", line 143, in __init__
    self.init_ancillary()
  File "/home/yanny/software/polymer-v4.12/polymer/level1_landsat8.py", line 155, in init_ancillary
    self.ozone = self.ancillary.get('ozone', self.date())
  File "/home/yanny/software/polymer-v4.12/polymer/ancillary_era5.py", line 57, in get
    file1 = self.ERA5.download_era5(t1)
  File "/home/yanny/software/polymer-v4.12/polymer/ancillary_era5.py", line 165, in download_era5
    target_tmp)
  File "/home/yanny/anaconda3/lib/python3.6/site-packages/cdsapi/api.py", line 310, in retrieve
    result = self._api('%s/resources/%s' % (self.url, name), request, 'POST')
  File "/home/yanny/anaconda3/lib/python3.6/site-packages/cdsapi/api.py", line 396, in _api
    raise Exception(error)
Exception: Resource reanalysis-era5-single-levels not found
Do you have any Suggestions for me?

Best regards,
southocean
Post Reply