Read Data
netCDF
We recommend using xarray
’s open_dataset
For a single file
import xarray as xr
= xr.open_dataset(filename) ds
For multiple files
import xarray as xr
= xr.open_mfdataset(list_of_filenames) ds
R code coming soon!
# Coming soon!
Matlab code coming soon!
#| echo: true
# Coming soon!
HDF5
For HDF5 files, there are two methods we can use: xarray
’s open_dataset and h5py
import xarray as xr
= xr.open_dataset(filename,
ds =path_to_H5netCDF_group) group
# add in directions for h5py
R code coming soon!
# Coming soon!
Matlab code coming soon!
#| echo: true
# Coming soon!
GeoTIFF
For GeoTIFF files, we recommend using rioxarray
’s open_rasterio
import rioxarray
= rioxarray.open_rasterio("my.tif") xds
R code coming soon!
# Coming soon!
Matlab code coming soon!
#| echo: true
# Coming soon!
Shapefiles & GeoJSON
To open shapefiles or GeoJSON, we recommend using geopandas
’s read_file
.
import geopandas as gpd
= gpd.read_file(filename) gdf
R code coming soon!
# Coming soon!
Matlab code coming soon!
#| echo: true
# Coming soon!
CSV
To open CSV files, we recommend using pandas
’s read_csv
.
import pandas as pd
= pd.read_csv(filename) df
R code coming soon!
# Coming soon!
Matlab code coming soon!
#| echo: true
# Coming soon!
Excel
To open Excel files, we recommend using pandas
’s read_excel
import pandas as pd
= pd.read_excel(filename) df
R code coming soon!
# Coming soon!
Matlab code coming soon!
#| echo: true
# Coming soon!
.mat Files
#coming soon! scipy & .mat
R code coming soon!
# Coming soon!
Matlab code coming soon!
#| echo: true
# Coming soon!
Binary Files
To open binary files, we recommend using numpy
’s from_file
. You will need to know the dimensions and data type of the binary file and if there is an offset or header information in the binary file.
import numpy as np
= np.from_file(filepath, dtype=data_type).reshape(nrows, ncols) arr
R code coming soon!
# Coming soon!
Matlab code coming soon!
#| echo: true
# Coming soon!