Download pool/shard005/Python/0044638_tscale_plevel.py from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard005/Python/0044638_tscale_plevel.py
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard005/Python/0044638_tscale_plevel.py
-
curl -L -o 0044638_tscale_plevel.py https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard005/Python/0044638_tscale_plevel.py
1.22 kB
| #!/usr/bin/env python | |
| """ This module computes atmospheric fields for a given elevation at the earths surface from pressure levvel data | |
| Example: | |
| as import: | |
| import tscale_plevel as tscale | |
| tscale.main(gridpath, Ngrid, 'rhumPl') | |
| Attributes: | |
| Todo: | |
| """ | |
| path2script = "./rsrc/tscale_plevel.R" | |
| # main | |
| def main(wd, nbox, var): | |
| """Main entry point for the script.""" | |
| run_rscript_fileout(path2script,[wd, nbox, var]) | |
| # functions | |
| def run_rscript_stdout(path2script , args): | |
| """ Function to define comands to run an Rscript. Returns an object. """ | |
| import subprocess | |
| command = 'Rscript' | |
| cmd = [command, path2script] + args | |
| print("Running:" + str(cmd)) | |
| x = subprocess.check_output(cmd, universal_newlines=True) | |
| return(x) | |
| def run_rscript_fileout(path2script , args): | |
| """ Function to define comands to run an Rscript. Outputs a file. """ | |
| import subprocess | |
| command = 'Rscript' | |
| cmd = [command, path2script] + args | |
| print("Running:" + str(cmd)) | |
| subprocess.check_output(cmd) | |
| # calling main | |
| if __name__ == '__main__': | |
| import sys | |
| wd = sys.argv[1] | |
| nbox = sys.argv[2] | |
| var = sys.argv[3] | |
| main(wd, nbox, var) | |