API Reference
jaxa.earth.je module
This API package for Python has developed to utillize various Earth observation data held by JAXA. By using this API, you can easily acquire and process data without worrying about the specifications, sensors, resolution, etc. of each satellite data.
je module contains four classes : FeatureCollection, ImageCollectionList,
ImageCollection, ImageProcess.
# Usage example
# Import module
from jaxa.earth import je
# Read geojson
geoj_path = "gadm36_JPN_0.geojson"
geoj = je.FeatureCollection().read(geoj_path).select([])
# Get images
data_out = je.ImageCollection("JAXA.EORC_ALOS.PRISM_AW3D30.v3.2_global")\
.filter_date(["2021-01-01T00:00:00","2022-01-01T00:00:00"])\
.filter_resolution(20)\
.filter_bounds(geoj[0])\
.select("DSM")\
.get_images()
# Process and show images
img = je.ImageProcess(data_out)\
.show_images()\
.calc_spatial_stats()\
.show_spatial_stats()
- class jaxa.earth.je.FeatureCollection
Bases:
objectThe
FeatureCollectionclass is used to read a feature collection and select features of geojson data from your computer.- Returns:
A
FeatureCollectionclass object which has a properry offeature_collection. the object’s properties are set to None by default.
- feature_collection
The property is updated after the method
readis executed. The default value is None.- Type:
dict
# Usage example: Aquire feature collection data geoj_path = "C:\MyData\gadm36_JPN_1.geojson" geoj = je.FeatureCollection().read(geoj_path).select(["Tokyo"])
- read(path: str)
The method
readreads the inputed path’s geojson data as feature collection.- Parameters:
path (str) – The absolute path to the user’s geojson location.
- Returns:
A
FeatureCollectionclass object that stores updatedfeature_collectionproperty
# Usage example: Read geojson data as feature collection data_path = "C:\MyData\MyArea.geojson" data_fc = je.FeatureCollection.read(data_path)
- select(keywords: list = [])
The method
selectfilter the inputed feature collection’s data in properties by keywords. The default is blank list, so all features of feature collection are selected.- Parameters:
keywords (list) – keywords list of your preferred words.
- Returns:
geojson features selected by keywords
# Usage example: Select feature from geojson's feature collection geojson = data_fc.select(["Japan","Tokyo"])
- class jaxa.earth.je.ImageCollection(collection: str = None, stac_cog_url: str = None, ssl_verify: bool = None)
Bases:
objectThe class,
ImageCollectiongets selected collection’s catalog json data from JAXA Earth database. When you use the class’s method, you can acquire collection’s raster images depending on query such as date limit, resolution, bounds and band.- Parameters:
collection (str) – Name of the selected collection. If not specified, “JAXA.EORC_ALOS.PRISM_AW3D30.v3.2_global” is used.
stac_cog_url (str) – Users can set valid stac cog url to
stac_cog_url.ssl_verify (bool) –
Users can set valid ssl certification process to
TrueorFalse. The default isTrue.Note
Setting the value to
Falsecan be a security risk.
- Returns:
An
ImageCollectionclass object which has properties ofstac_date,stac_ppu,stac_bounds,stac_bandandraster. All properties of the object are set to Noe by default.
- stac_date
The default value is None. The updated property is set after the method,
filter_date. The updated property has four properties such asquery,url,idandjson. The object is used as input to the methodfilter_resolution.- Type:
A
Stacclass object
- stac_ppu
The default value is None. The updated property is set after the method,
filter_resolution. The updated property has three properties such asquery,urlandjson. The object is used as input to the methodfilter_bounds.- Type:
A
Stacclass object
- stac_bounds
The default value is None. The updated property is set after the method,
filter_bounds. The updated property has three properties such asquery,urlandjson. The object is used as input to the methodselect.- Type:
A
Stacclass object
- stac_band
The default value is None. The updated property is set after the method,
select. The updated property has two properties such asqueryandurl. The object is used as input to the methodget_images.- Type:
A
Stacclass object
- raster
The default value is None. The updated property is set after the method,
get_images. The updatedRasterclass object property has properties ofimg,latlimandlonlim.- Type:
A
Rasterclass object
# Usage example: Get image data_out = je.ImageCollection("JAXA.EORC_ALOS.PRISM_AW3D30.v3.2_global")\ .filter_date(["2021-01-01T00:00:00","2023-01-31T00:00:00"])\ .filter_resolution(20)\ .filter_bounds([-180,-90,180,90])\ .select("DSM")\ .get_images()
- filter_bounds(bbox: list = None, geoj: dict = None)
The method,
filter_boundsfilters collection’s catalog json by the user query of bounds or geojson. If you input both of bbox and geoj, geoj is used to detect bounding box. If you don’t input neither of them, maximum bounding box is selected. In QGIS environment, appropriate area is selected with no input. The property ofstac_boundsis updated after the method.- Parameters:
bbox (list) – bounding box input.
geoj (dict) – geojson input
- Returns:
An
ImageCollectionclass object that stores updatedstac_boundsproperty
Note
Attention! You have to use method
filter_resolutionbefore the method.# Usage example: Filter ImageCollection by bbox of geojson bbox = [120,20,150,50] data_ic3 = data_ic2.filter_bounds(bbox)
- filter_date(dlim: list = [])
The method,
filter_datefilters collection’s catalog json by the user query of date limit. If no input is given, default date lim parameter is set as [“2021-01-01T00:00:00”,”2021-12-31T23:59:59”]. The property ofstac_dateis updated after the method.- Parameters:
date_lim (list) – date limits of minimum date, maximum date.
- Returns:
An
ImageCollectionclass object that stores updatedstac_dateproperty
Note
If normal products are specified for multiple years, the same products is returned for multiple years .
# Usage example: Filter ImageCollection by date limit date_lim = ["2021-01-01T00:00:00","2022-01-01T00:00:00"] data_ic1 = data_ic0.filter_date(date_lim)
- filter_resolution(ppu: float = None)
The method,
filter_resolutionfilters collection’s catalog json by the user query of resolution of ppu (Pixels Per Unit). Unit means one degree in epsg 4326, 32786m in epsg 3995. If no input is given, minimum value or appropriate value (in QGIS only) is set. The property ofstac_ppuis updated after the method.- Parameters:
ppu (float) – ppu input.
- Returns:
An
ImageCollectionclass object that stores updatedstac_ppuproperty
Note
Attention! You have to use method
filter_datebefore the method.# Usage example: Filter ImageCollection by ppu ppu = 20 data_ic2 = data_ic1.filter_resolution(ppu)
- get_images()
The method,
get_imagesgets collection’s images depending on the user’s queries of date limit, resolution, bounds and band. The property ofrasterwill be updated after the method. In addition to this, region of interest area ofrasterimages will be returned.- Returns:
An
ImageCollectionclass object that stores updatedrasterproperty
Note
Attention! You have to use method
filter_bandbefore the method.# Usage example: Get Image depend on user's query. data_out0 = data_ic4.get_images()
- select(band: str = None)
The method,
selectselects collection’s catalog json by the user query of band. If you don’t input band, the first band is selected. Property ofstac_bandwill be updated after the method.- Parameters:
band (str) – band of asset
- Returns:
An
ImageCollectionclass object that stores updatedstac_bandproperty
Note
Attention! You have to use method
filter_boundsbefore the method.# Usage example: Filter ImageCollection by band band = "DSM" data_ic4 = data_ic3.filter_band(band)
- class jaxa.earth.je.ImageCollectionList(ssl_verify: bool = None)
Bases:
objectThe class,
ImageCollectionListgets and filters collection’s catalog json depending on user input keywords.- Parameters:
ssl_verify (bool) –
Users can set valid ssl certification process to
TrueorFalse. The default isTrue.Note
Setting the value to
Falsecan be a security risk.- Returns:
An
ImageCollectionListclass object which has properties ofstac_collections.
# Usage example: Get collection's name and band keywords = ["LST","_half-month"] collections,bands = je.ImageCollectionList(ssl_verify=False)\ .filter_name(keywords=keywords)
- filter_name(keywords: list = [])
The method,
filter_namefilter collection’s catalog json from collection’s id depending on user input keywords.- Parameters:
keywords (list) – keywords of request.
- Returns:
filtered collections and filtered bands
# Usage example: Get collection's name and band key = ["LST","_half-month"] collections,bands = je.ImageCollectionList()\ .filter_name(keywords=key)
- class jaxa.earth.je.ImageProcess(data)
Bases:
objectThe class,
ImageProcessexecute various process by using inputedImageCollecionclass objects. When you useImageProcessclass method, you can process and get images such as masking images, differential images and calculated temporal/spatial statistics. In addition to the processing, it’s possible to show images or timeseries graph.- Parameters:
data (object) –
ImageCollectionclass object which contains updatedrasterpropertyNote
Attention!
ImageCollectionclass object must have correctrasterproperty.- Returns:
An
ImageProcessclass object with updated property
- raster
The default value is same as inputed
ImageCollectionclass object’srasterproperty. The property is updated after executing methods of theImageProcessclass object, such asmask_images,diff_imagesandcalc_temporal_stats.- Type:
A
Rasterclass object
- timeseries
The default value is None. The property is updated after executing methods of the
ImageProcessclass object, such ascalc_spatial_stats. The updated property has five keys and values such as “mean”, “std”, “min”, “max” and “median”.- Type:
dict
# Usage example: Process and show images img = je.ImageProcess(data_out0)\ .show_images()\ .calc_spatial_stats()\ .show_spatial_stats()
- calc_spatial_stats()
The method,
calc_spatial_statscalculate spatial statistics.- Returns:
An
ImageProcessclass object that stores updatedtimeseriesproperty. The updated property has five keys and values such as “mean”, “std”, “min”, “max” and “median”.
# Usage example: Calculate spatial stats of data_ip0 data_s_stats = data_ip0.calc_spatial_stats()
- calc_temporal_stats(method_query: str = 'mean')
The method,
calc_temporal_statscalculate temporal statistics by user inputed query of method_query.- Parameters:
method_query (dict) – “mean” or “max” or “min” or “std” or “median”. The default is “mean”.
- Returns:
An
ImageProcessclass object that stores the updatedrasterproperty
# Usage example: Calculate temporal stats of data_ip0 data_t_stats = data_ip0.calc_temporal_stats("mean")
- diff_images(ref)
The method,
diff_imagestake difference by user inputed query of ref.- Parameters:
ref (object) –
ImageCollectionclass object that has updatedrasterproperty which is used as ref data.Note
Attention! The shape of th ref (including resolution) must be the same as the data.
- Returns:
An
ImageProcessclass object that stores the updatedrasterproperty
# Usage example: Differential data(data_out0-data_out1) data_diff = data_ip0.diff_images(data_out1)
- mask_images(mask, method_query: str = 'values_equal', values: float = [0, 1])
The method,
mask_imagesmasks by using mask, type_query and values.- Parameters:
mask (class) –
ImageCollectionclass object that has updatedrasterproperty which is used as masking data.Note
Attention! The shape of the mask (including resolution) must be the same as the data.
method_query (dict) –
“range” or “values_equal” or “bits_equal”. The default method is “values_equal”.
”range” is used when users would like to extract a specific range of values and mask values outside the range. The data type of float is acceptable as a “range” mask.
”values_equal” is used when users would like to extract only certain bit values of pixels and mask other bit values of pixels. The data type of float is acceptable. Typically, land cover products is used as “values_equal” mask.
”bits_equal” is used when users would like to extract only certain values of pixels and mask other bit values of pixels. The data type of float is not acceptable as a mask. Typically, quality assurance products is used as a “bits_equal” mask.
values (list) – user query of values list. if you set type_query as “range”, please set two values, minimum and maximum. If “values_equal”, you can set multiple values list as you like. If “bits_equal”, you can set bit values 0 or 1 as bit values which begins from zero bit. The default value is [0,1].
- Returns:
An
ImageProcessclass object that stores the updatedrasterproperty
# Usage example: Mask data_out0 by data_out1 data_masked = data_ip0.mask_images(data_out1,"range",[0,100])
- show_images(cmap: str = None, clim: list = [])
The method,
show_imagesshows images ofrasterproperty. If multiple date’s image is set, the method shows all of the images.- Parameters:
cmap (str) – query of colormap name. User can choose “ndvi”,”turbo” and “spectral”. The default is “turbo”.
clim (list) – query of color range (optional).
- Returns:
An
ImageProcessclass object
# Usage example: Show images of data_ip0 data_ip0.show_images()
- show_images_qgis(cmap: str = None, clim: list = [])
The method,
show_images_qgisshows images in qgis.- Parameters:
cmap (str) – query of colormap name. User can choose “ndvi”,”turbo” and “spectral”. Default is “turbo”.
clim (list) – query of color range (optional).
- Returns:
An
ImageProcessclass object
Note
Attention! This method is only valid in QGIS environment.
# Usage example: Show images of data_ip0 in qgis data_ip0.show_images_qgis()
- show_spatial_stats(ylim: list = [])
The method,
show_spatial_statsshows graph of calculation result of the methodcalc_spatial_stats.- Parameters:
ylim (list) – query of color range (optional)
- Returns:
An
ImageProcessclass object
Note
Attention! You should use the method
calc_spatial_statsbefore the method.# Usage example: Show graph of calclation result of the method calc_spatial_stats data_s_stats.show_spatial_stats()