Getting Started

See Overview for installation instructions.

Authentication

Credentials depend on which STACSource you use, and only one is needed:

  • MPCSource (Microsoft Planetary Computer) works with no credentials at all – search and asset access both fall back to anonymous requests. A subscription key is optional and only raises the request rate limit, useful for large batch runs. Get one free at planetarycomputer.microsoft.com/account, then set it as an environment variable:

    export MPC_SUBSCRIPTION_KEY=your-key-here

    It’s picked up automatically; nothing needs to be passed in code or in a config file. Never commit the key value itself anywhere in the repo.

  • OPERASource (NASA OPERA RTC-S1 via ASF/CMR) requires a NASA Earthdata Login. Create a free account at urs.earthdata.nasa.gov, then set up a ~/.netrc entry for it. The recommended way is the built-in helper:

    from autofloods.authenticate import setup_earthdata_login
    
    setup_earthdata_login()

    This prompts for your username (input()) and password (getpass.getpass(), never echoed or logged), writes/updates the urs.earthdata.nasa.gov entry in ~/.netrc without touching any other entries already there, and restricts the file to owner-only permissions (chmod 600, skipped on Windows). For scripted or non-interactive setup, pass credentials directly instead of prompting (e.g. from an environment variable or secrets manager):

    setup_earthdata_login(username=my_username, password=my_password)

    Alternatively, you can set up ~/.netrc by hand, following NASA’s own .netrc setup instructions: urs.earthdata.nasa.gov/documentation/for_users/data_access/curl_and_wget. In short, add an entry to ~/.netrc:

    machine urs.earthdata.nasa.gov
      login your-username
      password your-password

    and restrict its permissions so other users on the machine can’t read your credentials:

    chmod 600 ~/.netrc

    Either way, requests picks this up automatically on the OAuth redirect; no environment variable or code change needed elsewhere.

    OPERASource also requires the GDAL command-line tools (gdalbuildvrt) to be installed separately – see Installation for the apt-get/conda commands.

Running AutoFloods

There are two ways to run AutoFloods: the flood_mapper class directly in a notebook/script (more control), or a config file + the runner script (fastest way to launch a real job, no code to write). Both use the same underlying pipeline and produce the same output. See Examples for grid generation and full walkthroughs of both.