As far as I know, in such cases, there might be two issues:
1) The boundary of your shapefile spans the boundary of the original NetCDF.
2) The output (new.nc) has a different data type with larger size. For
example, "mynectdf.nc" might be float32, and "new.nc" might be float64.

On Mon, May 15, 2023 at 3:05 PM Matina Nikolopoulou <[email protected]>
wrote:

> I have a netcdf  700MB, dp(time=169, lat=2250, lon=1670) and I want to
> clip it with a shapefile.
>
> data = xarray.open_dataset('mynetcdf.nc')
> data.rio.set_spatial_dims(x_dim="lon", y_dim="lat", inplace=True)
> data.rio.write_crs("epsg:4326", inplace=True)
> Shapefile = geopandas.read_file('mask1.shp', crs="epsg:4326")
> data_clipped = data.rio.clip(Shapefile.geometry.apply(mapping),
> Shapefile.crs, drop=False)
> data_clipped.to_netcdf('new.nc')
>
>  and the clipped one becomes  2gb.
>
> _______________________________________________
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting to
> this list:
> - Earning your support instead of buying it, but Ian Turton:
> http://www.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines:
> http://geoserver.org/comm/userlist-guidelines.html
>
> If you want to request a feature or an improvement, also see this:
> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>
>
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to