GRASS logo

NAME

t.rast.import.netcdf

KEYWORDS

SYNOPSIS

t.rast.import.netcdf
t.rast.import.netcdf --help
t.rast.import.netcdf [--help] [--verbose] [--quiet] [--ui]

Flags:

--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--ui
Force launching GUI dialog

Table of contents

DESCRIPTION

t.rast.import.netcdf imports content of one or more NetCDF files into a GRASS GIS Space Time Raster Dataset (STRDS). NetCDF files are expected to follow the CF-convention. Files not adhering to those standards may fail to import.

Input URL(s) to NetCDF files can be provided in the input option as either a file, with one URL to a dataset per line, a comma-separated list of URLs or a single URL. "-" causes input to be taken from stdin.

The module works for both local and remote data (e.g. on a Thredds Server). Data can be imported r.in.gdal or linked with r.external.

t.rast.import.netcdf can use GDALs Virtual Raster format (VRT) if data with Coordinate Reference systems that differ from the one of the current location are supposed to be imported.

Starting with GRASS GIS version 8.0, different variables or subdatasets in a NetCDF file can be imported as "semantic_label" into one STRDS. To achieve this, a configuration file has to be provided in the semantic_labels option. That configuration file maps subdatasets in the NetCDF file to GRASS GIS semantic_labels. Each line in that file must have the following format: input_netcdf_subdataset=grass_gis_band_reference The equal sign = is required. If a semantic_labels configuration file is provided, the import of subdatasets is limited to those subdatasets listed in that file. Hence, it can be used to filter variables of interest.

KNOWN ISSUES

The VRT format is also used when linking NetCDF data that contains subdatasets, as subdatasets are currently not supported in r.external.

REQUIREMENTS

Support of semantic_labels is only available with GRASS GIS 8.0 or later. t.rast.import.netcdf uses the following non-standard Python modules:

EXAMPLES

Link Sentinel-2 scenes from the Norwegian Ground Segment

# Choose Scenes to import (see also m.crawl.thredds module)
echo "https://nbstds.met.no/thredds/fileServer/NBS/S2A/2021/02/28/S2A_MSIL1C_20210228T103021_N0202_R108_T35WPU_20210228T201033_DTERRENGDATA.nc
https://nbstds.met.no/thredds/fileServer/NBS/S2A/2021/02/28/S2A_MSIL1C_20210228T103021_N0202_R108_T32VNL_20210228T201033_DTERRENGDATA.nc" > nc.txt

# Create a semantic_label configuration file
echo "B1=S2_1
B2=S2_2" > semantic_labels.conf

# Import data (link NetCDF files without downloading them)
t.rast.import.netcdf -l input=nc.txt output=S2A semantic_labels=semantic_labels.conf \
memory=2048 nprocs=2 nodata="-1"

Import Norwegian Climate data

# Create a semantic_label configuration file
echo "tg=temperature_avg
tn=temperature_min" > semantic_labels.conf

# Import data within a selected time window
t.rast.import.netcdf output=SeNorge semantic_labels=semantic_labels.conf \
memory=2048 nprocs=2 start_time="2020-08-01" end_time="2021-08-01" \
input=https://thredds.met.no/thredds/fileServer/senorge/seNorge_2018/Archive/seNorge2018_2020.nc

Append to STRDS from previous imports

# Choose dataset to import (see also m.crawl.thredds module)

# Create a semantic_label configuration file
echo "tg=temperature_avg
tn=temperature_min" > semantic_labels.conf

# Import data within a selected time window
t.rast.import.netcdf output=SeNorge semantic_labels=semantic_labels.conf \
memory=2048 nprocs=2 -a start_time="2020-08-01" end_time="2021-08-01" \
input=https://thredds.met.no/thredds/fileServer/senorge/seNorge_2018/Archive/seNorge2018_2021.nc

TODO

  1. Capture and store extended metadata in a way that allows for filtering of relevant maps.
  2. Improve printing of metadata and file structure
  3. Support more options of Virtual Raster files (data type, ...)

SEE ALSO

t.rast.import, r3.out.netcdf, r.semantic_labels, i.bands_library, r.support m.crawl.thredds,

AUTHORS

Stefan Blumentrath, Norwegian Institute for Nature Research (NINA), Oslo

SOURCE CODE

Available at: t.rast.import.netcdf source code (history)


Main index | Temporal index | Topics index | Keywords index | Graphical index | Full index

© 2003-2019 GRASS Development Team, GRASS GIS 7.8.2 Reference Manual