Page 1 of 1

Bulk donwload L2 aqua-modis data

Posted: Tue Oct 15, 2024 8:11 am America/New_York
by giorgiocastellan
Hi, I'm trying to download several Sentinel Level 2 Aqua-MODIS data on IOPs for specific days and locations (coordinates). My aim is to get .nc files with the solar azimuth (csolz) for a particular ___location and day. Is there a way to search and download these files using R or Python?

Many thanks

Re: Bulk donwload L2 aqua-modis data

Posted: Tue Oct 15, 2024 10:15 am America/New_York
by OB ScienceSW - jlindo1
Hi there,

Thanks for reaching out. There is already a Python implementation of a satellite data finder in our Ocean Color Science Software packaged with SeaDAS. A tutorial can be found here: https://seabass.gsfc.nasa.gov/wiki/validation_matchup_tools. This script even includes an option to download the files that match your search!

I hope this helps. Please don't hesitate to reach back out with any more questions!

~ Jakob

Re: Bulk donwload L2 aqua-modis data

Posted: Tue Oct 15, 2024 11:12 am America/New_York
by ASDC - alexrad71
I am not sure what you mean by "Sentinel Level 2 Aqua-MODIS data on IOPs" but I assume IOPs stands for inherent optical properties which implies ocean properties. For this reason, I search for Sentinel L2 data related to ocean optics, see the screenshot
Image
If you see your collection of interest, hover over it and "i" button will show up. Click on it, and under the collection title find its short name, see green box in the screenshot below. I selected collection titled "Sentinel-3A OLCI Level-2 Earth-observation Full Resolution (EFR) Inherent Optical Properties (IOP) Data, version R2022.0".
Image

Then you can use this collection short name with earthaccess python library to download what you need, see example code below:
*****************************************
import earthaccess
import os
import platform
from subprocess import Popen
import shutil

# Establishing access to EarthData,
# for more information on the earthaccess see https://earthaccess.readthedocs.io/en/latest/
# User needs to create an account at https://www.earthdata.nasa.gov/
# Function earthaccess.login prompts for EarthData login and password.
auth = earthaccess.login(strategy="interactive", persist=True)

# Establishing home directory
homeDir = os.path.expanduser("~") + os.sep

with open(homeDir + '.dodsrc', 'w') as file:
file.write('HTTP.COOKIEJAR={}.urs_cookies\n'.format(homeDir))
file.write('HTTP.NETRC={}.netrc'.format(homeDir))
file.close()

print('Saved .dodsrc to:', homeDir)

# Set appropriate permissions for Linux/macOS
if platform.system() != "Windows":
Popen('chmod og-rw ~/.netrc', shell=True)
else:
# Copy dodsrc to working directory in Windows
shutil.copy2(homeDir + '.dodsrc', os.getcwd())
print('Copied .dodsrc to:', os.getcwd())

#Set up collection information along with timeframe and region of interest
short_name = 'OLCIS3A_L2_EFR_IOP' # collection name to search for in the EarthData
date_start = '2018-05-01 00:00:00' # start date
date_end = '2018-05-31 23:59:59' # end date
[POI_lat, POI_lon] = [0., 0.] # point of interest (POI)
bbox = (POI_lon - 0.5, POI_lat - 0.5, POI_lon + 0.5, POI_lat + 0.5) # 1 degree bounding box around POI

# search for granules
results = earthaccess.search_data(short_name = short_name\
, temporal = (date_start, date_end)
, bounding_box = bbox)

# download granules
downloaded_files = earthaccess.download(results, local_path='.',)
*****************************************