aodn / python-aodntools

Repository for templates and code relating to generating standard NetCDF files for the Australia Ocean Data Network
GNU Lesser General Public License v3.0
10 stars 3 forks source link

Use of aggregated_timeseries.py with local files #130

Closed nmalan closed 3 years ago

nmalan commented 3 years ago

I am currently fiddling with aggregated_timeseries.py on some of the mooring files that we have stored at UNSW to try and replicate the timeseries products (the goal is to eventually recover some data which is currently flagged out of the timeseries product).

I'd like to use the function to point to local files instead of a list of url's i.e. python aggregated_timeseries.py -var TEMP -site BMP120 -files /<path-to-local-files>/*.nc

Is there a straightforward way of doing this, or would I need to dig into rewriting some of aggregated_timeseries.py?

mhidas commented 3 years ago

The "list of URLs" can just be a list of local paths relative to the current directory (or to a path specified by -indir) The -files argument should be a text file, where each line is the (relative) path to a netCDF file. So for example in a bash terminal you can do something like

> cd /<path-to-local-files>/
> find . -type f -name '*BMP120*.nc' >file_list
> python3 aggregated_timeseries.py -var TEMP -site BMP120 -files file_list

Hope that makes sense!

nmalan commented 3 years ago

Thanks @mhidas! Works like a charm