Created
November 5, 2020 04:23
-
-
Save prl900/a6f07391bf72516c37c7642e7f23e355 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datacube | |
from datacube.drivers.netcdf import write_dataset_to_netcdf | |
import argparse | |
parser = argparse.ArgumentParser(description="""Script to request Sentinel2 data from the NCI and save it as NetCDF""") | |
parser.add_argument('-lat', '--latitude', type=float, required=True, help="Latitude for central point of tile") | |
parser.add_argument('-lon', '--longitude', type=float, required=True, help="Latitude for central point of tile") | |
parser.add_argument('-dst', '--destination', required=True, type=str, help="Full path to destination.") | |
args = parser.parse_args() | |
dc = datacube.Datacube(app="loading_data") | |
measurements= ["nbart_blue", "nbart_green", "nbart_red","nbart_nir_1", "nbart_nir_2", "nbart_swir_2", "nbart_swir_3"] | |
ds = dc.load(product="s2a_ard_granule", x=(args.longitude-0.05, args.longitude+0.05), y=(args.latitude+0.05, args.latitude-0.05), time=("2018-01","2018-02"), measurements=measurements, output_crs="EPSG:3577", resolution=(-10, 10), group_by="solar_day") | |
#ds = dc.load(product="s2a_ard_granule", x=(lon-0.05, lon+0.05), y=(lat+0.05, lat-0.05), measurements=measurements, output_crs="EPSG:3577", resolution=(-10, 10), group_by="solar_day") | |
write_dataset_to_netcdf(ds, args.destination) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ module use /g/data/v10/public/modules/modulefiles/
$ module load dea
$ python s2_extractor.py -lat -27.5 -lon 153.3 -dst ./test.nc