-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get uxarray running with FVCOM model output #385
Comments
Thanks for the issue and PR. How do I download and open this file? Can xarray (no uxarray) open it?
|
Here is the landing page for a given file on the server: So you can use the HTTPserver link for downloading: |
You might need to drop another variable also, I just read this in with xarray, and note that the server isn't very reliable so sometimes I have to run it a few times.
|
cc @jonmjoyce also |
It would be good to provide a good test file, rather than links to a OPenDAP server. I sent a 2D one that xarray will open via email for a start, but ideally, we'd make a test file that's a LOT smaller. Maybe I'll get to that in a couple days, but I"ve got some other pressing issues to dal with now. @kthyng: maybe you could whip one out with extract_model? |
It is pretty big but it is also what is used so it has that advantage. I would guess that for now it will work ok, esp since they can download the file if they want to work locally. |
This dataset works for now, but a smaller one would be great so we could add it to our test files! I'll work on getting a reader function for the model output. Would either of you be able to provide me a reference document to the mesh definition/specifications, possibly similar to this one from MPAS |
Latest dev version of xarray should now work out of the box :-) |
@kthyng any updates on a small test file? please test and report with if the above changes work for you. Thanks! |
Just released. See if it works for you! |
@ChrisBarker-NOAA Do you have a test FVCOM file handy? It would take me a bit to get up and running to get one made. |
FVCOM is a commonly-used ocean model with an unstructured triangular mesh. The community would like to be able to use uxarray with this model output, as well as other unstructured ocean models, but this is a good one to start with.
To Reproduce
With a small change implemented in PR #384, here is the status of reading in an example FVCOM file. (Note that the date will have to be moved forward at some point as these files do not stay around forever. If needed, bump up the date in two places to today's date.)
Currently (with the PR) this returns:
Full stack trace:
File ~/packages/uxarray/uxarray/core/api.py:165, in open_dataset(grid_filename_or_obj, filename_or_obj, gridspec, vertices, islatlon, isconcave, use_dual, **kwargs)
109 """Wraps
xarray.open_dataset()
, given a grid topology definition with a110 single dataset file or object with corresponding data.
111
(...)
161 >>> ux_ds = ux.open_dataset("grid_filename.g", "grid_filename_vortex.nc")
162 """
164 ## Grid definition
--> 165 uxgrid = open_grid(grid_filename_or_obj,
166 gridspec=gridspec,
167 vertices=vertices,
168 islatlon=islatlon,
169 isconcave=isconcave,
170 use_dual=use_dual,
171 **kwargs)
173 ## UxDataset
174 ds = xr.open_dataset(filename_or_obj, decode_times=False,
175 **kwargs) # type: ignore
File ~/packages/uxarray/uxarray/core/api.py:90, in open_grid(grid_filename_or_obj, gridspec, vertices, islatlon, isconcave, use_dual, **kwargs)
85 else:
86 grid_ds = xr.open_dataset(grid_filename_or_obj,
87 decode_times=False,
88 **kwargs) # type: ignore
---> 90 uxgrid = Grid(grid_ds,
91 gridspec=gridspec,
92 vertices=vertices,
93 islatlon=islatlon,
94 isconcave=isconcave,
95 source_grid=str(grid_filename_or_obj),
96 use_dual=use_dual)
98 return uxgrid
File ~/packages/uxarray/uxarray/core/grid.py:100, in Grid.init(self, input_obj, **kwargs)
97 # check if initializing from string
98 # TODO: re-add gridspec initialization when implemented
99 elif isinstance(input_obj, xr.Dataset):
--> 100 self.mesh_type = parse_grid_type(input_obj)
101 self.from_ds(dataset=input_obj)
102 else:
File ~/packages/uxarray/uxarray/utils/helpers.py:48, in parse_grid_type(dataset)
46 mesh_type = "mpas"
47 else:
---> 48 raise RuntimeError(f"Could not recognize dataset format.")
49 return mesh_type
51 # check mesh topology and dimension
RuntimeError: Could not recognize dataset format.
Expected behavior
Not sure yet since I haven't used
uxarray
successfully, but presumably read in the model output file without error and then be able to do some stuff with it.OS:
Mac
Environment
The text was updated successfully, but these errors were encountered: