π¦ Reading dataο
EOmaps provides some basic capabilities to read and plot directly from commonly used file-types.
Note
At the moment, the readers are intended as a βshortcutβ to read well-structured datasets!
If they fail, read the data manually and then set the data as usual via Maps.set_data()
.
Under the hood, EOmaps uses the following libraries to read data:
GeoTIFF (
rioxarray
+xarray.open_dataset()
)NetCDF (
xarray.open_dataset()
)CSV (
pandas.read_csv()
)
Read data from a fileο
m.read_file.<filetype>(...)
can be used to read all relevant data (e.g. values, coordinates & crs) from a file.
m = Maps()
data = Maps.read_file.NetCDF(
"the filepath",
parameter="adsf",
coords=("longitude", "latitude"),
data_crs=4326,
isel=dict(time=123)
)
m.set_data(**data)
...
m.plot_map()
|
Read all relevant information necessary to add a GeoTIFF to the map. |
|
Read all relevant information necessary to add a NetCDF to the map. |
|
Read all relevant information necessary to add a CSV-file to the map. |
Initialize a Maps-object from a fileο
Maps.from_file.<filetype>(...)
can be used to directly initialize a Maps
object from a file.
(This is particularly useful if you have a well-defined file-structure that you need to access regularly)
m = Maps.from_file.GeoTIFF(
"the filepath",
classify_specs=dict(Maps.CLASSFIERS.Quantiles, k=10),
cmap="RdBu"
)
m.add_colorbar()
m.cb.pick.attach.annotate()
|
Convenience function to initialize a new Maps-object from a GeoTIFF file. |
|
Convenience function to initialize a new Maps-object from a NetCDF file. |
|
Convenience function to initialize a new Maps-object from a CSV file. |
Create a new layer from a fileο
Similar to Maps.from_file
, a new layer based on a file can be added to an existing Maps
object via Maps.new_layer_from_file.<filetype>(...)
.
m = Maps()
m.add_feature.preset.coastline()
m2 = m.new_layer_from_file(
"the filepath",
parameter="adsf",
coords=("longitude", "latitude"),
data_crs=4326,
isel=dict(time=123),
classify_specs=dict(Maps.CLASSFIERS.Quantiles, k=10),
cmap="RdBu"
)
|
Convenience function to initialize a new Maps-object from a GeoTIFF file. |
|
Convenience function to initialize a new Maps-object from a NetCDF file. |
|
Convenience function to initialize a new Maps-object from a CSV file. |