I have been able to read a netcdf file:
import xarray as xr
ds_disk = xr.open_dataset(file_nc_in)
Then I have read a shape file as:
shapefile_path = 'shapefile.shp'
shp_noce = gpd.read_file(shapefile_path)
This is my projection:
shp_noce.crs
erived Projected CRS: EPSG:32632>
Name: WGS 84 / UTM zone 32N
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: Between 6°E and 12°E, northern hemisphere between equator and 84°N, onshore and offshore. Algeria. Austria. Cameroon. Denmark. Equatorial Guinea. France. Gabon. Germany. Italy. Libya. Liechtenstein. Monaco. Netherlands. Niger. Nigeria. Norway. Sao Tome and Principe. Svalbard. Sweden. Switzerland. Tunisia. Vatican City State.
- bounds: (6.0, 0.0, 12.0, 84.0)
Coordinate Operation:
- name: UTM zone 32N
- method: Transverse Mercator
Datum: World Geodetic System 1984 ensemble
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
I would like to follow this post in order to mask my netcdf file.
However, I get the following error:
Unable to allocate 21.9 GiB for an array with shape (14245, 643, 641) and data type float32
Is it possible to work time step by time step? How can I remove nan. I do not think that it is useful to keep all the data stored, even of the cut region.
any suggestions?
thanks