Short note of GrADS commands
https://www.dkrz.de/up/services/analysis/visualization/sw/grads/GrADS_reference_card.pdf?lang=en
Short note of GrADS commands
https://www.dkrz.de/up/services/analysis/visualization/sw/grads/GrADS_reference_card.pdf?lang=en
someuseful ncl examples
https://www.dkrz.de/up/services/analysis/visualization/sw/ncl/ncl-examples
>>> import numpy.ma as ma >>> a = np.arange(4) >>> a array([0, 1, 2, 3]) >>> ma.masked_less(a, 2)
for this you need the three time series data sets , fill between values (above(y_upper_series) and below(ylow_serie values)) and the actual values(ysearies)
plt.figure()
plt.plot(xseries,yseries,color=’red’, linewidth=2,label=’test’,linestyle=’-‘,marker=’.’)
plt.fill_between(xmon,ylow_series,y_upper_series, alpha=0.4, edgecolor=’mediumorchid’, facecolor=’plum’)
more info
https://matplotlib.org/gallery/recipes/fill_between_alpha.html
https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.fill_between.html
http://gradsusr.org/pipermail/gradsusr/2006-February/002740.html
set t 1 365
define a=ave(var,t+0,t+6) ! for a 7-day running mean
go with the third method: sys.exit.
quit
raises the SystemExit
exception behind the scenes.
Furthermore, if you print it, it will give a message:
>>> print (quit)
Use quit() or Ctrl-Z plus Return to exit
>>>
This functionality was included to help people who do not know Python. After all, one of the most likely things a newbie will try to exit Python is typing in quit
.
Nevertheless, quit
should not be used in production code. This is because it only works if the site
module is loaded. Instead, this function should only be used in the interpreter.
exit
is an alias for quit
(or vice-versa). They exist together simply to make Python more user-friendly.
Furthermore, it too gives a message when printed:
>>> print (exit)
Use exit() or Ctrl-Z plus Return to exit
>>>
However, like quit
, exit
is considered bad to use in production code and should be reserved for use in the interpreter. This is because it too relies on the site
module.
sys.exit
raises the SystemExit
exception in the background. This means that it is the same as quit
and exit
in that respect.
Unlike those two however, sys.exit
is considered good to use in production code. This is because the sys
module will always be there.
os._exit
exits the program without calling cleanup handlers, flushing stdio buffers, etc. Thus, it is not a standard way to exit and should only be used in special cases. The most common of these is in the child process(es) created by os.fork
.
Note that, of the four methods given, only this one is unique in what it does.
Summed up, all four methods exit the program. However, the first two are considered bad to use in production code and the last is a non-standard, dirty way that is only used in special scenarios. So, if you want to exit a program normally, go with the third method: sys.exit
.
To finding the name of the current shell’s executable
echo $0
Or
ps -ef | grep $$ | grep -v grep
First, find out available shell list:
$ less /etc/shells
Try linux command chsh.
The detailed command is chsh -s /bin/bash. It will prompt you to enter your password. Your default login shell is /bin/bash now. You must log out and log back in to see this change.
The following is quoted from man page:
The chsh command changes the user login shell. This determines the name of the users initial login command. A normal user may only change the login shell for her own account, the superuser may change the login shell for any account
This command will change the default login shell permanently.
Note: If your user account is remote such as on Kerberos authentication (e.g. Enterprise RHEL) then you will not be able to use chsh.
https://www.cyberciti.biz/faq/howto-change-linux-unix-freebsd-login-shell/
To find out available shell list:
$ less /etc/shells
Sample Outputs:
/bin/ash
/bin/csh
/bin/sh
/usr/bin/es
/bin/ksh
/bin/tcsh
/bin/sash
/bin/zsh
/bin/dash
/usr/bin/screen
/bin/bash
/bin/rbash
For correlation coefficient you can directly use pearsonr function, for RMSE, you can defne a function as below
from scipy.stats.stats import pearsonr
##———– functions ————
def rmsef(predictions, targets):
return np.sqrt(((predictions – targets) ** 2).mean())
def averagef(arr, n):
end = n * int(len(arr)/n)
return np.mean(arr[:end].reshape(-1, n), 1)
rmse= rmsef(modlra,obsr)
corr = pearsonr(modlra,obsr)
corrC= corr[0]
import csv
myData = [[1, 2, 3], ['Good Morning', 'Good Evening', 'Good Afternoon']]
myFile = open('csvexample3.csv', 'w')
with myFile:
writer = csv.writer(myFile)
writer.writerows(myData)
import csv with open('eggs.csv', 'w', newline='') as csvfile: spamwriter = csv.writer(csvfile, delimiter=' ', quotechar='|', quoting=csv.QUOTE_MINIMAL) spamwriter.writerow(['Spam'] * 5 + ['Baked Beans']) spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
‘set vpage 0 11 0 8.5’
‘set parea 1.7 5.7 4.8 8.4’
1st plot
‘set parea 5.7 9.7 4.8 8.4’
2nd plot
‘set parea 1.7 5.7 1.1 4.8’
3rd plot
‘set parea 5.7 9.7 1.1 4.8’
4th plot
http://gradsusr.org/pipermail/gradsusr/2011-September/031053.html