Skip to content
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

Make mod parameters public? #59

Closed
JackKelly opened this issue Sep 24, 2024 · 2 comments
Closed

Make mod parameters public? #59

JackKelly opened this issue Sep 24, 2024 · 2 comments

Comments

@JackKelly
Copy link
Contributor

JackKelly commented Sep 24, 2024

mod parameters is currently declared private in templates/product/mod.rs.

Would you consider making parameters public, please?

(All the other modules in templates/product/mod.rs are public. And all the modules in templates/product/parameters/mod.rs are public, too)

Why?!

I should explain my use-case, just in case I'm barking up the wrong tree!

hypergrib is all about lazily loading GRIB files from cloud object storage for huge multi-GRIB datasets.

Given a key (consisting of the NWP variable name, reference time, forecast step, vertical level, and ensemble member) hypergrib needs to lookup the location of the relevant GRIB message (i.e. the path of the GRIB file, the byte offset, and message length).

The plan is for hypergrib to maintain a HashMap<Key, MessageLocation>.

The Key could be a String generated by Message:key (which, if I've understood correctly, outputs strings like "TEMP20170101095050:phyfcst") (I'd need to append the ensemble member).

But I'd prefer Key to be a struct like this:

struct Key {
  reference_time: DateTime<Utc>,
  forecast_step: TimeDelta,
  product: Product,
  vertical_level: VerticalLevel,
  ensemble_member: EnsembleMember,
}

where Product would be an enum like this:

use gribberish::templates::product::parameters::meteorological;

enum Product {
  TemperatureProduct(meteorological::TemperatureProduct),
  MoistureProduct(meteorological::MoistureProduct),
  MomentumProduct(meteorological::MomentumProduct),
  CloudProduct(meteorological::CloudProduct),
  // etc.
}

But this won't compile because parameters is private!

(Please let me know if you think this is a bad way to structure things!)

@mpiannucci
Copy link
Owner

mpiannucci commented Sep 24, 2024

making them public is fine with me! That is a level of customization i have thought about but havent gotten to solving

@JackKelly
Copy link
Contributor Author

JackKelly commented Oct 1, 2024

Closing this issue now that the PR is merged. (Thanks!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants