简体   繁体   中英

How to import a particular parameter from multiple nc files into xarray in python

I want to read a particular parameter from multiple nc files using xarrays in python. I want to make time as an another dimension using xarray. How to do it? Could you please resolve my issue?

Edit: I have a nc files of subdaily data

import xarray as xr

ds = xr.open_mfdataset('/home/atmosphere/data/gridsat/GRIDSAT-B1.2013.07.01.*.v02r01.nc',engine='netcdf4', concat_dim='Time')

But I am getting an error

ValueError: arguments without labels along dimension 'Ngeo' cannot be aligned because they have different dimension sizes: {6, 7}

There are few more dimensions with a name Ngeo on the dataset, which I don't need to use (I don't want to import whole parameters from the file, my required parameter to be imported is irwin_cdr along with lat and lon).

As bwc suggested, 'drop_vars=' did very well. So I could ignore the parameters having different dimension name like 'Ngeo' Hence the line I used is,

ds=xr.open_mfdataset(fname,drop_variables=('satlat','satlon','satrad','satname')

Thanks bwc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM