Hi
I have installed Pyroms using kate's branch https://github.com/ESMG/pyroms.
I try plotting figures on the model's output but cannot understand how to use it.
There are some codes in pyroms_toolbox for plotting.
For example zview.
This is for depth I think.
For plotting, where should I put Roms's history file or define depth, ocean time, and temp which script should I run?
Is it possible to explain step by step to use Zview for example for plotting?
Best,
Problem using kate's pyroms
Re: Problem using kate's pyroms
It is has been said by he who wrote the thing that this should be enough documentation:
So you import pyroms_toolbox, then call it with the appropriate arguments, after first loading/initializing a pyroms grid object. Note that as it is using basemap, it is already obsolete.
Code: Select all
def zview(var, tindex, depth, grid, filename=None, \
cmin=None, cmax=None, clev=None, clb_format='%.2f', \
fill=False, contour=False, d=4, range=None, fts=None, \
title=None, clb=True, pal=None, proj='merc', \
fill_land=False, outfile=None):
"""
map = zview(var, tindex, depth, grid, {optional switch})
optional switch:
- filename if defined, load the variable from file
- cmin set color minimum limit
- cmax set color maximum limit
- clev set the number of color step
- fill use contourf instead of pcolor
- contour overlay contour (request fill=True)
- range set axis limit
- fts set font size (default: 12)
- title add title to the plot
- clb add colorbar (defaul: True)
- pal set color map (default: cm.jet)
- proj set projection type (default: merc)
- fill_land fill land masked area with gray (defaul: True)
- outfile if defined, write figure to file
plot a constant-z slice of variable var. If filename is provided,
var must be a string and the variable will be load from the file.
grid can be a grid object or a gridid. In the later case, the grid
object correponding to the provided gridid will be loaded.
If proj is not None, return a Basemap object to be used with quiver
for example.
"""
Re: Problem using kate's pyroms
Hi
Thanks, kate for your response!
I am a new user of Python so it is a little difficult for me. In the past, I used Matlab for plotting ROMS.
I have two different files:
My grid file is in this address in my system :/home/jabmubuntu/ROMS_OUTPUT/roms_grd.nc
My average file is in this address in my system: /home/jabmubuntu/ROMS_OUTPUT/roms_avg.nc
to plot zview
map=zview(var,tindex,depth,grid,filename=None\cmin=None,cmax=None...)
For example,
var=temp
tindex(ocean time)=1
depth=-1
cmin=10
cmax=20
when I call zview, I have faced an error.
is it possible to give me one example of how to use it in more detail?
Thanks!
Thanks, kate for your response!
I am a new user of Python so it is a little difficult for me. In the past, I used Matlab for plotting ROMS.
I have two different files:
My grid file is in this address in my system :/home/jabmubuntu/ROMS_OUTPUT/roms_grd.nc
My average file is in this address in my system: /home/jabmubuntu/ROMS_OUTPUT/roms_avg.nc
to plot zview
map=zview(var,tindex,depth,grid,filename=None\cmin=None,cmax=None...)
For example,
var=temp
tindex(ocean time)=1
depth=-1
cmin=10
cmax=20
when I call zview, I have faced an error.
is it possible to give me one example of how to use it in more detail?
Thanks!
Re: Problem using kate's pyroms
I'm getting an error too:
My attempt:
I know these things only work for the Mercator projection, but it is not my priority to fix this (ever).
Code: Select all
Traceback (most recent call last):
File "zlook.py", line 18, in <module>
proj=proj, \
File "/import/home/kshedstrom/pyroms/pyroms_toolbox/pyroms_toolbox/zview.py", line 152, in zview
resolution='h', area_thresh=5.)
File "/import/c1/AKWATERS/kate/.conda/envs/snowdrifts/lib/python3.7/site-packages/mpl_toolkits/basemap/__init__.py", line 776, in __init__
raise ValueError('must specify boundinglat and lon_0 for %s basemap' % _projnames[projection])
ValueError: must specify boundinglat and lon_0 for North-Polar Stereographic basemap
Code: Select all
import pyroms_toolbox
import pyroms
#----------------------------------------------------------------------------------------------
# example
grd = pyroms.grid.get_ROMS_grid('ARCTIC4')
depth = 200.0
tindex = 0
var = 'temp'
proj = 'npstere'
filename = 'months/arctic4_1998_08.nc'
pyroms_toolbox.zview(var, tindex, depth, grd, filename, \
proj=proj, \
)