NAME
m.csv.clean - Creates a cleaned-up copy a CSV files
Creates CSV files which are ready to used in GRASS GIS
KEYWORDS
miscellaneous,
CSV,
ASCII
SYNOPSIS
m.csv.clean
m.csv.clean --help
m.csv.clean input=name separator=character output=name prefix=string [recognized_date=string[,string,...]] [clean_date=string] missing_names=string [cell_clean=string[,string,...]] [--overwrite] [--help] [--verbose] [--quiet] [--ui]
Flags:
- --overwrite
- Allow output files to overwrite existing files
- --help
- Print usage summary
- --verbose
- Verbose module output
- --quiet
- Quiet module output
- --ui
- Force launching GUI dialog
Parameters:
- input=name [required]
- Input CSV file to clean up
- Name of input file
- separator=character [required]
- Field separator
- Special characters: pipe, comma, space, tab, newline
- Default: comma
- output=name [required]
- Clean CSV output file
- Name for output file
- prefix=string [required]
- Prefix for columns which don't start with a letter
- Prefix itself must start with a letter of English alphabeth
- Default: col_
- recognized_date=string[,string,...]
- Recognized date formats (e.g., %m/%d/%y)
- For example, %m/%d/%Y,%m/%d/%y matches 7/30/2021 and 7/30/21
- clean_date=string
- Format for new clean-up date
- For example, %Y-%m-%d for 2021-07-30
- Default: date_%Y-%m-%d
- missing_names=string [required]
- Names for the columns without a name in the header
- If only one is provided, but more than one is need, underscore and column number is added
- Default: column
- cell_clean=string[,string,...]
- Operations to apply to non-header cells in the body of the document
- If only one is provided, but more than one is need, underscore and column number is added
- Options: strip_whitespace, collapse_whitespace, date_format, none
- Default: strip_whitespace,collapse_whitespace
m.csv.clean reads a CSV (Comma Separated Value) file,
cleans it, and writes a new CSV file.
The separator for CSV is comma (
,
) by default,
but it can be set to any single character such as semicolon (
;
),
pipe (
|
), or tabulator.
Originally, the name for this module was supposed to be
m.csv.polish
and the module was to be accompanied with module named
m.csv.czech
for checking the state of the CSV.
The following would apply all the default fixes to the the file
sampling_sites_raw.csv
and output a cleaned file
sampling_sites.csv
:
m.csv.clean input=sampling_sites_raw.csv output=sampling_sites.csv
The module is not using any information from the current location and mapset,
so it is very easy to run it with an adhoc temporary location
by executing a
grass --exec
command:
grass --tmp-location XY --exec m.csv.clean input=sampling_sites_raw.csv output=sampling_sites.csv
-
v.in.csv
for an addon module for importing CSV as vector points with coordinate transformation,
-
v.in.ascii
for importing CSV as vector points with different approach,
-
v.in.ogr
for an alternative CSV import using GDAL/OGR.
Vaclav Petras,
NCSU Center for Geospatial AnalyticsSOURCE CODE
Available at:
m.csv.clean source code
(history)
Latest change: Thursday Feb 03 09:32:35 2022 in commit: f17c792f5de56c64ecfbe63ec315307872cf9d5c
Main index |
Miscellaneous index |
Topics index |
Keywords index |
Graphical index |
Full index
© 2003-2023
GRASS Development Team,
GRASS GIS 8.2.2dev Reference Manual