SolarArbiter / solarforecastarbiter-core

Core data gathering, validation, processing, and reporting package for the Solar Forecast Arbiter
https://solarforecastarbiter-core.readthedocs.io
MIT License
33 stars 21 forks source link

Custom DOMAIN for fetchnwp #686

Open williamhobbs opened 2 years ago

williamhobbs commented 2 years ago

To significantly reduce NWP file sizes, I've been modifying the DOMAIN in /solarforecastarbiter/io/nwp.py, e.g., for a region in the Southeast:

DOMAIN = {'subregion': '',
          'leftlon': -90.5,
          'rightlon': -80.5,
          'toplat': 35.2,
          'bottomlat': 30}

Maybe there's a better way to do this, but if not, would it make sense to allow a custom domain to be defined through the command line interface as an option for fetchnwp?

Similar, but maybe less useful, would be the ability to define an upper limit on the valid hour for a model. For example, if someone wants to use the GEFS for a probabilistic forecast, but they are not interested in forecasting beyond 24 hours, they could avoid having to save data for hours 30-384 (or whatever the relevant intervals are for GEFS).

wholmgren commented 2 years ago

From a quick glance, it seems reasonable to add those arguments to cli.fetchnwp and propagate them down through io.fetch.nwp.run and helper functions.

Considerations:

I suppose another option is reading from environment variables e.g.

DOMAIN = {'subregion': '',
          'leftlon': os.environ.get('SFA_DOMAIN_LEFTLON', -90.5),
          'rightlon': -80.5,  # and so on...
          'toplat': 35.2,
          'bottomlat': 30}