Comments (2)
As an example of the code needed to use
import xarray as xr
from metintos.io import *
import xesmf
pth = "cosmo.grib"
ds = xr.open_dataset(pth, engine='h5netcdf')
def interpolate_ds_to_pc_grid(ds_input, lat_lims=(43.8, 57), lon_lims=(0, 17), lat_res=64, lon_res=64):
ds = ds_input.isel(x=slice(None, None, 2), y=slice(None, None, 2))
dsh = DatasetHandler(ds)
cg = CoordinateGenerator()
cg.add_axis_lims_n_points('latitude', lat_lims[0], lat_lims[1], lat_res)
cg.add_axis_lims_n_points('longitude', lon_lims[0], lon_lims[1], lon_res)
new_coords = dsh.complete_new_coords(**cg.axes)
new_coords = {k: v for k, v in new_coords.items() if k not in ('time', 'surface')}
new_dims = new_coords.keys()
new_shape = dsh.get_coords_shape(new_dims, new_coords)
new_var_array = np.zeros(new_shape, dtype=np.float32)
new_data_array = xr.DataArray(data=new_var_array,
coords=new_coords,
dims=new_dims,
name='foo',
attrs=ds.attrs)
regridder = xesmf.Regridder(ds, new_data_array, 'bilinear')
return regridder(ds)
dsn = interpolate_ds_to_pc_grid(ds)
dsn.to_netcdf('cosmo_of_reduced.nc')
from metintos.
added on commit 696b464
from metintos.
Related Issues (8)
- Expand test along all function and class
- check before optical flow that the coords are in boundaries
- Improve METINTOS lib documentation description
- Add aditional information in every function
- Add some description before calling the function to read the comment in py files
- Add cv2 dependency to the project
- not support non ensemble dataset HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metintos.