Is there elsewhere to put the .cdsapirc file? Running it on Databricks


Hi everyone, I am trying to extract ERA5 data on Databricks. It turns out that the home path (home/) is not available in Databricks because I don't have access right to it. So, is there any way that I can manage to use my cdsapi and extract data in Databricks?

For who finds this, a sollution I found for databricks:

import os

# Set the API credentials as environment variables
os.environ['CDSAPI_URL'] = ''
os.environ['CDSAPI_KEY'] = 'your_api_key_here'

Make sure to use the correct API key you find on How to use the CDS API | Copernicus Climate Data Store

1 Like

FYI, this is the setup we use on our Azure Databricks:

url = 'url:'
key = 'key: your_api_key_here'

with open('/root/.cdsapirc', 'w') as f:
    f.write('\n'.join([url, key]))