-
Notifications
You must be signed in to change notification settings - Fork 16
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
Friendlier code and API #72
Conversation
:rtype: string | ||
|
||
""" | ||
grid_topology = nc.get_variables_by_attributes(cf_role='grid_topology') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: need to make this work in older versions of netcdf4-python.
The latest commit (ocefpaf@6823f94) splits the By avoiding calling Before this PR the notebook example took ~10 s to run, now it takes ~5 s. Note that the gain there was just by not downloading (the rarely used) |
Great progress. sci-wms needs to know too much information about what an sgrid is:
Anything that closes the implementation gap between pysgrid and potential users. I'd love it if sci-wms never had:
Basically, all data access should assume the user wants it back on the centers and pad/slice/rotate as needed. If a user wants the raw data they can just use |
@kwilcox I agree to all that! And some of those should make into First: are you OK with the changes proposed in this PR? #72 (comment) If so, the next step should be:
I have a few ideas (#73 and #74) brewing. They all boils down to perform lazy trimmings and lazy center/node averages. That would get us close to a PS: I am opening another issue for those points you raised. |
👍 +1 to the changes here |
@ayan-usgs can you spare some time to review and merge this? (If not I am planning to merge this next week.) |
This all looks solid. Thanks for coding up these improvements! |
The goal of this PR is to resurrect some of the topics we discussed in APIRUS (ping @rsignell-usgs ). @ayan-usgs I'd appreciate if you could review and comment on it. @kwilcox you are the only one I know that is using
pysgrid
on production, so your feedback is very welcomed!Summary:
abc
SGridND and the SGrid3D to reduce the code complexity for newcomers. The SGrid2D was renamned to SGrid;ValueError
s when properties (values) are not found (akin topyugrid
);find_grid_topology_var()
is no longer a method ofNetCDFDataset
. It became some sort of stand-alone compliance checker function (and should probably be renamed);find_grid_topology_var()
. Also, some of those calls could take the topology variable as input even though it sill automatically looked for it later one. That was simplified in this version;from_ncfile
andfrom_nc_dataset
were replaced byload_sgrid
that can takenc
datasets, file names, or URLs. (I plan to do the same inpyugrid
... I guess we could rename it toload_grid
.);The long term goal is to get rid of the
NetCDFDataset
class and fold all of its functionality into a SGRID compliance checker. This compliance checker will takecall_backs
to parse non-compliant datasets.Hopefully, with a simpler code base, we can start tracking some of bottlenecks that are plaguing
sci-wms
.