NCAR / NCAR/wrf-python

Dataset read muti-time data in one file

Open
#89 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug support
Dominant language
Python
Stars
498
Forks
178
PR merge metrics
No merged PRs in 30d

Description

I have a wrfout data with 24h data
dimensions(sizes): Time(24), DateStrLen(19), west_east(87), south_north(74), bottom_top(23), bottom_top_stag(24), soil_layers_stag(4), west_east_stag(88), south_north_stag(75)
ncfile = Dataset("wrfout_d01_2019-03-22_00:00:00")

Extract the pressure, geopotential height, and wind variables
p = getvar(ncfile, "pressure")
z = getvar(ncfile, "z", units="dm")
ua = getvar(ncfile, "ua", units="kt")
va = getvar(ncfile, "va", units="kt")
wspd = getvar(ncfile, "wspd_wdir", units="kts")[0,:]
p just have 3 dims
<xarray.DataArray 'pressure' (bottom_top: 23, south_north: 74, west_east: 87)>

wher I use
ncfiles=MFDataset("wrfout_d01_2019-03-22_00:00:00")
p = getvar(ncfiles, "pressure")
z = getvar(ncfiles, "z", units="dm")
ua = getvar(ncfiles, "ua", units="kt")
va = getvar(ncfiles, "va", units="kt")
wspd = getvar(ncfiles, "wspd_wdir", units="kts")[0,:]

RuntimeError: NetCDF: Not a valid ID

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported case using Dataset and MFDataset with the shown getvar calls, then trace where the NetCDF "Not a valid ID" error is triggered. Check how multi-time files and the pressure, height, wind, and wind-speed variables are handled; done means identifying a confirmed cause and a tested resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.