Describe the bug:
I am using the same API for the exact location, requested parameter, and year, as mentioned in the example both using python and MATLAB. The Python module worked just fine, whereas the MATLAB module returned with 503 Service unavailable:
Error using Matlab.internal.webservices.HTTPConnector/copyContentToByteArray The server returned the status 503 with message "Service Unavailable" in response to the request to URL https://developer.nrel.gov/api/hsds/?api_key=qiaxEl3sgvbvvolnjTLelLTw2zZHPbvwu7uXJaKh&domain=%2Fnrel%2FUS_wave%2FWest_Coast%2FWest_Coast_wave_1995.h5.
Error in readContentFromWebService (line 46) byteArray = copyContentToByteArray(connection);
Error in webread (line 125) [varargout{1:nargout}] = readContentFromWebService(connection, options);
Error in request_wpto (line 72) root = webread(baseURL);
Unfortunately, I have to use MATLAB to streamline all the data traffic for the current project. Would you happen to have any idea to fix this?
To reproduce:
Using the same code provided in the example, just with a different API key:
data_type = '3-hour'; % setting the data type to the 3-hour dataset
year = (1995)';
lat_lon = [44.624076,-124.280097];
parameter = "significant_wave_height";
api_key ='qiaxEl3sgvbvvolnjTLelLTw2zZHPbvwu7uXJaKh';
Hs = request_wpto(data_type,parameter,lat_lon,year,api_key);
Expected behavior:
Returning struct file with Hs in timeseries format.
Hs.metadata
ans = struct with fields:
water_depth: 77.429496765136719
latitude: 44.624298095703125
longitude: -1.242789993286133e+02
distance_to_shore: 1.562217578125000e+04
timezone: -8
jurisdiction: 'Federal'
Desktop:
Windows Ver: Win 10
Matlab Ver: 2023a
Python Ver: 3.10
Mhkit Ver: 0.6.0
Thank you!
Danu