Design and development: Vitali Sharmar, Alexander Gavrikov and Andrey Muratov Wave-Hindcast. All Rights Reserved
Each of the selected wave hindcast (ERA5-WW3, CFSR-WW3, MERRA2-WW3, ERAi-WW3) is available through the Data Access Protocol (DAP). The data can be accessed in two ways described below: downloading to local PC or using direct access. Both ways require an account at WAVE-HINDCAST server. If you do not have an account yet, please sign up. After recieving an e-mail of confirmation of registration at wave-hindcast.ocean.ru you can sign in.
This approach to getting the data is preferable. It exploits the full capacity of the Data Access Protocol and avoids downloading huge amounts of data. You access one of the wave hindcasts inside your script, therefore your programming language of choice must have libraries that implement the Data Access Protocol.
Ensure that an up-to-date version of Pydap, requests and lxml are installed:
pip install Pydap requests lxml
from pydap.client import open_url from pydap.cas.get_cookies import setup_session # connect to the NAAD database session = setup_session("https://wave-hindcast.ocean.ru/accounts/login/", username="USER_NAME", password="USER_PASSWORD" ) # get the file handler dataset = open_url('https://wave-hindcast.ocean.ru/dap/dapserver/CFSR-WW3/1980/cfsr_ww3_1980_hs.nc', session=session) # read the variable var = dataset['hs'] # print the array sizes print(var.shape)
This way of obtaining the data may be more conventional but is not recommended because it is generally slow and takes a lot of storage on a user's machine. Nevertheless, two methods are available:
web interface
To access the data you need to sign in to the WAVE-HINDCAST server. You will then be able to see the file structure and to download the wave hindcast data manually.
wget
The example below downloads all files with SWH according to the CFSR-WW3 hindcast in the folder https://wave-hindcast.ocean.ru/dap/CFSR-WW3/. Don't forget to replace USER_NAME and USER_PASSWORD with your username and password.
#!/bin/bash USERNAME="USER_NAME"; PASSWORD="USER_PASSWORD"; LOGIN_PAGE="https://wave-hindcast.ocean.ru/accounts/login/"; COOKIES_FILE="naadcookies.txt"; CSRF=`wget -qO- --keep-session-cookies --save-cookies $COOKIES_FILE $LOGIN_PAGE \ | grep "csrfmiddlewaretoken"|sed -e's/.*name=\"//;s/value//;s/[\",\>,\ ]//g;'`; wget -qO- --keep-session-cookies --load-cookies $COOKIES_FILE \ --save-cookies $COOKIES_FILE \ --post-data "username=$USERNAME&password=$PASSWORD&$CSRF" \ --referer $LOGIN_PAGE $LOGIN_PAGE wget --keep-session-cookies --load-cookies $COOKIES_FILE \ -r --no-parent https://wave-hindcast.ocean.ru/dap/CFSR-WW3/
Design and development: Vitali Sharmar, Alexander Gavrikov and Andrey Muratov Wave-Hindcast. All Rights Reserved