This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#A one liner that tries to extract as generally as possible an integer number value from fortran name list in bash (number of soil layers in this case): | |
ignd=$(sed -n "/&physics_cfgs/I,/\//p" "${nmlfile}" | grep -i cLass_IG | grep "=" | grep -Eo '[[:digit:]]+') | |
##Explanation: | |
#1: select the namelist with sed (note ignoring case on the name of the namelist) | |
#2: look for the lines containing the parameter name (ignoring case here too) | |
#3: select only the lines which contain "=" sign. | |
#4: get only digits from the line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qs | grep -E -o '^[0-9]+' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import biggus | |
import numpy as np | |
def main(): | |
x = np.random.randn(10, 10) | |
y = np.ma.masked_where(x > 0, x) | |
yinv = np.ma.masked_where(~y.mask, x) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from netCDF4 import Dataset | |
#input file | |
dsin = Dataset("crop.nc") | |
#output file | |
dsout = Dataset("crop.nc3", "w", format="NETCDF3_CLASSIC") | |
#Copy dimensions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
""" | |
Author: Huziy | |
Purpose: Automate folder creation for different processes | |
""" | |
def main(): | |
args = sys.argv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for id in $(ps ax | grep bootstrap.py | cut -d" " -f1) | |
do | |
kill -9 $id | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cdo infov ANUSPLIN_latlon_stmn_2005_11.nc | |
-1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name | |
1 : 0000-00-01 00:00:00 0 544680 0 : nan nan nan : daily_minimum_temperature | |
2 : 0000-00-02 00:00:00 0 544680 0 : nan nan nan : daily_minimum_temperature | |
3 : 0000-00-03 00:00:00 0 544680 0 : nan nan nan : daily_minimum_temperature | |
4 : 0000-00-04 00:00:00 0 544680 0 : nan nan nan : daily_minimum_temperature | |
5 : 0000-00-05 00:00:00 0 544680 0 : nan nan nan : daily_minimum_temperature | |
6 : 0000-00-06 00:00:00 0 544680 0 : nan nan nan : daily_minimum_temperature | |
7 : 0000-00-07 00:00:00 0 544680 0 : nan nan nan : daily_minimum_temperature | |
8 : 0000-00-08 00:00:00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cdo infov ANUSPLIN_latlon_stmn_2005_11.nc | |
-1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name | |
1 : 2005-11-01 00:00:00 0 544680 287417 : -33.800 -10.348 10.620 : daily_minimum_temperature | |
2 : 2005-11-02 00:00:00 0 544680 287417 : -38.890 -11.761 11.000 : daily_minimum_temperature | |
3 : 2005-11-03 00:00:00 0 544680 287417 : -42.150 -12.516 11.690 : daily_minimum_temperature | |
4 : 2005-11-04 00:00:00 0 544680 287417 : -46.670 -12.967 13.740 : daily_minimum_temperature | |
5 : 2005-11-05 00:00:00 0 544680 287417 : -45.040 -13.658 13.910 : daily_minimum_temperature | |
6 : 2005-11-06 00:00:00 0 544680 287417 : -45.100 -14.014 11.840 : daily_minimum_temperature | |
7 : 2005-11-07 00:00:00 0 544680 287417 : -43.120 -13.841 10.800 : daily_minimum_temperature | |
8 : 2005-11-08 00:00:00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
folder=. | |
prefix=ANUSPLIN_latlon_stmn_ | |
var_name=daily_minimum_temperature | |
for x in ${folder}/${prefix}*.nc | |
do | |
x_name=$(basename $x) | |
part=$(echo $x_name | cut -d"." -f 1) | |
#get the year and month from the file name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#set -x | |
echo $1 | |
found=$(fgrep --text "At" $1 | fgrep "User" | fgrep "Time" | fgrep "(sec)") | |
#echo "$found" | |
echo "-----------------------------------------------------------------------" | |
echo "start: " $(echo "$found" | head -1 | cut -f 1 -d"," ) |