Usage Examples for Python
Get and show an image
The simplest usage example — get and show an image using all default values:
from jaxa.earth import je
# Get an image
data = je.ImageCollection(ssl_verify=True) \
.filter_date() \
.filter_resolution() \
.filter_bounds() \
.select() \
.get_images()
# Process and show an image
img = je.ImageProcess(data) \
.show_images()

To get the raw numpy array and display it:

Search collection ID and Band
Browse all available datasets at: https://data.earth.jaxa.jp/en/datasets/
Use ImageCollectionList.filter_name() to search by keywords:
from jaxa.earth import je
# Get all collections and bands
collections, bands = je.ImageCollectionList(ssl_verify=True) \
.filter_name()
collection_index = 0
band_index = 0
collection = collections[collection_index]
band = bands[collection_index][band_index]
print(f" - collection : {collection}, band : {band}")
Get and show an image by region of interest
Set region of interest by bounding box
from jaxa.earth import je
dlim = ["2021-01-01T00:00:00","2021-01-01T00:00:00"]
ppu = 5
bbox = [110, 20, 160, 50]
collection = "NASA.EOSDIS_Terra.MODIS_MOD11C1-LST.daytime.v061_global_half-monthly"
band = "LST"
data = je.ImageCollection(collection=collection, ssl_verify=True) \
.filter_date(dlim=dlim) \
.filter_resolution(ppu=ppu) \
.filter_bounds(bbox=bbox) \
.select(band=band) \
.get_images()
img = je.ImageProcess(data) \
.show_images()

Set region of interest by GeoJSON
Create GeoJSON data from geojson.io or convert from shapefile in QGIS:
from jaxa.earth import je
dlim = ["2021-01-01T00:00:00","2021-01-01T00:00:00"]
ppu = 20
collection = "NASA.EOSDIS_Aqua.MODIS_MYD11C1-LST.daytime.v061_global_half-monthly-normal"
band = "LST_2012_2021"
geoj_path = "test.geojson"
geoj = je.FeatureCollection().read(geoj_path).select()
data = je.ImageCollection(collection=collection, ssl_verify=True) \
.filter_date(dlim=dlim) \
.filter_resolution(ppu=ppu) \
.filter_bounds(geoj=geoj[0]) \
.select(band=band) \
.get_images()
img = je.ImageProcess(data) \
.show_images()

Get and show a masked image
Extract range data pixels
Mask GSMaP precipitation data by AW3D elevation range [0.1, 1000]:
from jaxa.earth import je
dlim = ["2021-02-01T00:00:00","2021-02-01T00:00:00"]
ppu = 10
bbox = [110, 20, 160, 50]
# Get data
data_d = je.ImageCollection("JAXA.EORC_GSMaP_standard.Gauge.00Z-23Z.v6_half-monthly-normal", ssl_verify=True) \
.filter_date(dlim=dlim).filter_resolution(ppu=ppu) \
.filter_bounds(bbox=bbox).select("PRECIP_2012_2021").get_images()
# Get mask
data_m = je.ImageCollection("JAXA.EORC_ALOS.PRISM_AW3D30.v3.2_global", ssl_verify=True) \
.filter_date(dlim=dlim).filter_resolution(ppu=ppu) \
.filter_bounds(bbox=bbox).select("DSM").get_images()
# Apply mask
img = je.ImageProcess(data_d) \
.mask_images(data_m, method_query="range", values=[0.1, 1000]) \
.show_images()

Extract values equal data pixels
Mask AW3D elevation by LCCS land cover value 190 (urban areas):
from jaxa.earth import je
dlim = ["2019-01-01T00:00:00","2021-02-01T00:00:00"]
ppu = 360
bbox = [139.5, 35, 140.5, 36]
data_d = je.ImageCollection("JAXA.EORC_ALOS.PRISM_AW3D30.v3.2_global", ssl_verify=True) \
.filter_date(dlim=dlim).filter_resolution(ppu=ppu) \
.filter_bounds(bbox=bbox).select("DSM").get_images()
data_m = je.ImageCollection("Copernicus.C3S_PROBA-V_LCCS_global_yearly", ssl_verify=True) \
.filter_date(dlim=dlim).filter_resolution(ppu=ppu) \
.filter_bounds(bbox=bbox).select("LCCS").get_images()
img = je.ImageProcess(data_d) \
.mask_images(data_m, method_query="values_equal", values=[190]) \
.show_images()

Extract bits equal data pixels
AW3D DSM (Elevation) masked by AW3D MSK (Mask) using bits_equal. All zero bits means effective pixels:
from jaxa.earth import je
dlim = ["2019-01-01T00:00:00","2021-02-01T00:00:00"]
ppu = 360
bbox = [139.5, 35, 140.5, 36]
collection = "JAXA.EORC_ALOS.PRISM_AW3D30.v3.2_global"
data_d = je.ImageCollection(collection, ssl_verify=True) \
.filter_date(dlim=dlim).filter_resolution(ppu=ppu) \
.filter_bounds(bbox=bbox).select("DSM").get_images()
data_m = je.ImageCollection(collection, ssl_verify=True) \
.filter_date(dlim=dlim).filter_resolution(ppu=ppu) \
.filter_bounds(bbox=bbox).select("MSK").get_images()
img = je.ImageProcess(data_d) \
.mask_images(data_m, method_query="bits_equal", values=[0,0,0,0,0,0,0,0]) \
.show_images()

Get and show a differential image
Differential image between NDVI (monthly) and NDVI (monthly-normal) using diff_images:
from jaxa.earth import je
dlim = ["2021-08-01T00:00:00","2021-08-01T00:00:00"]
bbox = [-180, -90, 180, 90]
# Data
data_d = je.ImageCollection("JAXA.JASMES_Terra.MODIS-Aqua.MODIS_ndvi.v811_global_monthly", ssl_verify=True) \
.filter_date(dlim=dlim).filter_resolution() \
.filter_bounds(bbox=bbox).select("ndvi").get_images()
# Reference (normal)
data_r = je.ImageCollection("JAXA.JASMES_Terra.MODIS-Aqua.MODIS_ndvi.v811_global_monthly-normal", ssl_verify=True) \
.filter_date(dlim=dlim).filter_resolution() \
.filter_bounds(bbox=bbox).select("ndvi_2012_2021").get_images()
img = je.ImageProcess(data_d) \
.diff_images(data_r) \
.show_images()

Get and show a composite image
Composite multiple daily images into one using calc_temporal_stats:
from jaxa.earth import je
dlim = ["2021-08-01T00:00:00","2021-08-10T00:00:00"]
bbox = [-180, -90, 180, 90]
data = je.ImageCollection("JAXA.G-Portal_GCOM-W.AMSR2_standard.L3-SMC.daytime.v3_global_daily", ssl_verify=True) \
.filter_date(dlim=dlim).filter_resolution() \
.filter_bounds(bbox=bbox).select("SMC").get_images()
img = je.ImageProcess(data) \
.calc_temporal_stats("mean") \
.show_images()

Calculate and show timeseries data
Calculate spatial statistics over multiple dates and display as a time series graph:
from jaxa.earth import je
dlim = ["2021-01-01T00:00:00","2021-12-31T00:00:00"]
bbox = [120, 20, 150, 50]
ppu = 10
collection = "JAXA.JASMES_Aqua.MODIS_swr.v811_global_half-monthly-normal"
band = "swr_2012_2021"
data = je.ImageCollection(collection, ssl_verify=True) \
.filter_date(dlim=dlim).filter_resolution(ppu=ppu) \
.filter_bounds(bbox=bbox).select(band).get_images()
img = je.ImageProcess(data) \
.calc_spatial_stats() \
.show_spatial_stats()
# Access the timeseries numpy arrays
print(img.timeseries["mean"])
print(img.timeseries["std"])
print(img.timeseries["min"])
print(img.timeseries["max"])
print(img.timeseries["median"])
