Import Related Modules¶
These modules are for importing data. Unlike the existing modules, they can import all files in a directory
by considering a certain pattern. Moreover, it is possible to import these data in different mapsets
. In addition,
the module i_fr_import
can import pyroSAR
datasets in a directory based on their metadata.
The name of the modules was chosen to ensure conformity with the GRASS GIS conventions. The addition r
stands for
raster where the addition d
and f
stand for directory and finder respectively.
Note, it is important for the parameter `pattern` that the asterisk(‘*’) contains a dot (see examples).
-
class
gscpy.i_import.i_dr_import.
DirImport
(input_dir, pattern=None, extension=None)[source]¶ Import data into a mapset from a file with considering certain patterns.
Parameters: - input_dir (str) – The directory where the files are located.
- pattern (str, optional) – The pattern of file names. If not specified all files with selected extension will be imported.
- extension ({'ENVI', 'GEOTIFF'}, optional) – Which extensions should be recognized? Default is ‘GEOTIFF’
-
input_dir
¶ Type: str
-
extension
¶ Type: str
-
filter_p
¶ Combines pattern and extension.
Type: str
-
files
¶ All detected files.
Type: list
Examples
The general usage is
$ i.dr.import [-r -l -c -p] input_dir=string [pattern=string] [extension=string] [mapset=string] [dbase=string] [location=string] [--verbose] [--quiet]
Import files that starts with ‘S1’ from a directory in current mapset and reproject it
$ i.dr.import -r input_dir=/home/user/data pattern=S1.*
Import files that starts with ‘S1’ from a directory in a new mapset and reproject it
$ i.dr.import -c -r input_dir=/home/user/data pattern=S1.* mapset=Goettingen
Notes
Note, it is important for the parameter pattern that the asterisk(‘*’) contains a dot (see examples).
- Flags:
- r : Reproject raster data (using r.import if needed).
- l : Link raster data instead of importing.
- c : Create a new mapset.
- p : Print the detected files and exit.
-
create_mapset
(mapset, dbase=None, location=None)[source] Create a new mapset calling the module g.c.mapset.
Parameters: - mapset (str, optional) – Name of mapset.
- dbase (str, optional) – Location of GRASS GIS database
- mapset – Name of the mapset that will be created.
Returns: Return type: None
-
import_products
(reproject=False, link=False)[source] Import detected files.
Parameters: - reproject (bool) – Reproject raster data (using r.import if needed).
- link (bool) – Link raster data instead of importing.
Returns: Return type: None
-
print_products
()[source] Print all detected files.
Returns: Return type: None