Visualizing WRF domain

There are many ways to visualize the spatial domain of WRF. I have used several of them in my previous papers, but they turned out to be not so elegant for publications. Therefore, while writing the dissertation recently, I developed some functions that can directly digest WPS namelist (rather than WRF output in some cases) to derive the domain boundaries. Figure 1 is an example plot.

Figure 1. Visualization of WRF domain from home-made Python. Background is the topography from ETOPO1 dataset.

Continue reading

Plotting in Cartopy

I have been using Basemap for years in my Python scripting. Now I would like to slowly switch to Python 3, but Basemap is no longer officially supported there. There seems to be some workaround (such as using customized versions of Basemap), but personally I do not want to try that. So, I guess it is time to find an alternative, such as Cartopy.

In this post, I leave a record of my learning more about Cartopy, as well as some useful tricks (that I found out after hours of experiments..) Continue reading

Linux miscellaneous

A notebook on some tricks in Linux. For some of them, I learned them from the Internet. For the rest, I got it by playing around it myself.

1.    cURL

1.1. Continue the interrupted downloading process

Use “-C” option. Specially, if we want cURL to automatically determine the location to continue transfer, then use “-C -“.

 curl -C - https://sample.tgz 

This would also save the failed file transfer from wget. Continue reading

CDO notebook

This is to record some interesting use of CDO, just to avoid frequent Googling…

1.    GRIB1 file, from Gaussian reduced grid to regular Gaussian grid:

 cdo setgridtype,regular <infile> <outfile> 

This is mainly used to pre-process ECMWF data. For the explanation on the reduced Gaussian grid, see ref [1]. Specific, this handles the issue:

Warning (cdfDefRgrid) : Creating a netCDF file with data on a gaussian reduced grid.
Warning (cdfDefRgrid) : The further processing of the resulting file is unsupported!

 

2.    Delete select timesteps in the NetCDF file

 cdo delete,timestep=1,10,20 <infile> <outfile> 

Note the counter starts from 1.

 

 

 

References:

[1] Reduced Gaussian grid.

HYSPLIT installation

HYSPLIT is a software used for air parcel trajectory computation. It is developed by NOAA ARL, and has been used for a range of studies. In my study I use it for air moisture tracing, and there are numerous parcels I need to trace, so I figured it out that it many easier to work in Linux (i.e. HYSPLIT together with shell scripting). There are some confusions as to how to install it, and some modifications are needed in the default configuration (at least to me).

Continue reading

NCL learning

Post processing WRF is a big task, especially when different tasks come in different times. Most of the time I can find pretty simple (and beautiful) solutions in NCL, so I decided to learn more about it. I will add more to this post when I get new codes that are useful.

NCL means NCAR Command Language, and here is the official website. It is designed to handle the climate data, so WRF is kind of natively supported. It has a package called “WRFUserARW.ncl”, which is super helpful in processing WRF results.

NCL has 3 main references, and they are great tools to start with. Here I mainly handling NetCDF files, and I am only putting some useful quick notes (or short code piece) in case I need them. Continue reading

Home directory in Jupyter

I recently installed Anaconda on my SP3 ( I am switching to Python as my main scripting language). However, by default setup, Jupyter (the successor of Ipython) always starts in my home directory, which is C:\Users\xxxxx. Here are the steps to change this setting.

1. Go to the Jupyter install directory. In my case, it is “D:\Program Files\Anaconda\Scripts”. From here run (in command windows)

jupyter notebook --generate-config

Now we will have a file called “.jupyter/jupyter_notebook_config.py” in the above home directory.

2. Then go to the home directory, and edit the configuration file we just got. Search for ” # c.NotebookApp.notebook_dir = u” “, and put the desired path here. This will result in something like:

# c.NotebookApp.notebook_dir = u’E:\Research\Ipython’

3. Now restart the Jupyter, and it will show the new home directory.

 

关于中文软件的

这个帖子拿来记一些和中文软件相关的毛病。

  1. 开机启动项里的YoukuMediaCenter

前两天安装了youku的客户端,用起来觉得不爽,遂卸载之。不过完了就发觉个挺讨厌的事情,在win10的开机启动项里多了个YoukuMediaCenter,无法定位到源文件,也无法disable。查阅网上资料,发觉作怪的是注册表里的残余项。把下面这个entry删除,然后世界就清静了。在这个文件夹下顺便还可以清理一些别的开机启动项。

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run]
Display Name : YoukuMediaCenter
Path : C:\Users\xxxxx\AppData\Roaming\ytmediacenter\YoukuMediaCenter.exe iku://|start|

GMT 4 and 5 syntax trick

Just a follow-up of what I mention in “Software installation in CentOS 7 for Scientific Computation”. Now GMT project team is maintaining both GMT 4 and 5. This will be the official case till the announcement of GMT 6. The biggest (and perhaps the first one you will notice) change is that in GMT 5, there are no single executables like “psxy”. Instead, they need to be called as “gmt psxy”.

Unfortunately, there are still lots of scripts written in GMT 4 syntax. I am having this problem now, and there are two methods that can quickly get you back to the GMT 4 “environment”. But be cautious that the usage of some commands are slightly different in GMT 4 and 5, so these methods does not guarantee the old GMT 4 scripts work as we expect under GMT 5. Besides, GMT 4 will come to its end of support sooner or later, so the better way is, as you can guess, a fresh start in GMT 5. Continue reading