Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

streamlines #269

Closed
doutriaux1 opened this issue Nov 8, 2017 · 17 comments
Closed

streamlines #269

doutriaux1 opened this issue Nov 8, 2017 · 17 comments
Assignees
Milestone

Comments

@doutriaux1
Copy link
Contributor

import vcs
import cdms2
import os
f= cdms2.open(os.path.join(cdat_info.get_sampledata_path(),"clt.nc"))
u=f("u")
v=f("v")
x=vcs.init()
st = vcs.createstreamline()                                                                   
x.plot(u(latitude=(-10,10),longitude=(-120,-95)),v(latitude=(-10,10),longitude=(-120,-95)),st)
x.png("blah")

blah

@doutriaux1 doutriaux1 added the bug label Nov 8, 2017
@doutriaux1 doutriaux1 added this to the 3.0 milestone Nov 8, 2017
@aashish24
Copy link
Contributor

did it broke recently?

@danlipsa
Copy link
Contributor

danlipsa commented Nov 8, 2017

@doutriaux1 Try setting gm.startseed to be inside the domain.

@doutriaux1
Copy link
Contributor Author

that did it!

st.startseed = [-100,0,0]

@danlipsa we should default it to None and manually pick a point inside the domain

@doutriaux1
Copy link
Contributor Author

@danlipsa it's probably worth explaining in your notebook tutorial

@potter2
Copy link

potter2 commented Nov 8, 2017

I still don't get any streamlines.

import cdms2
import vcs
f1=cdms2.open('uas_6hr_reanalysis_CFSR_1998010100-1998123118.nc')
f2=cdms2.open('vas_6hr_reanalysis_CFSR_1998010100-1998123118.nc')
u=f1('uas',time=('1998-10-27','1998-10-29'),lat=(12,16),lon=(-96,-82))
v=f2('vas',time=('1998-10-27','1998-10-29'),lat=(12,16),lon=(-96,-82))
#u=f1('uas',time=('1998-10-27','1998-10-29'))
#v=f2('vas',time=('1998-10-27','1998-10-29'))
x=vcs.init()
gm=x.createstreamline()
gm.evenlyspaced = False         # only available on releases after 2.10 or on the nightly packages.
# streamlines are colored by vector magnitude
gm.coloredbyvector = True
# We want 10 glyphs(arrows) per streamline
gm.numberofglyphs = 10
gm.filledglyph = True
# we place 400 random seeds in a circle that covers the data. This means fewer seeds will be inside the data.
# The number of seeds inside the data will result in streamlines.
gm.numberofseeds = 400
gm.evenlyspaced = True # only available only on releases > 2.10 or on the nightly packages
# We want the streamline to be about one cell apart from each other
gm.separatingdistance = 1
# The seed for the first streamline. All other seeds are generated automatically
gm.startseed = [-90, 0, 0]
# create an evenly spaced streamline plot
x.plot(u, v, gm, bg=1)

@doutriaux1
Copy link
Contributor Author

doutriaux1 commented Nov 8, 2017

@potter2 you need to get a pint within your domain
gm.startseed = [-90, 0, 0] has a lat of 0 which is outside of your domain
you want
gm.startseed = [-90, 14,0] # [x,y,z]

@potter2
Copy link

potter2 commented Nov 8, 2017

got it. Thanks now it works

@doutriaux1 doutriaux1 added enhancement and removed bug labels Nov 8, 2017
@danlipsa
Copy link
Contributor

danlipsa commented Nov 8, 2017

@doutriaux1 None for startseed is a good idea. This way I can leave the value as is if the user sets it. We should do that.

@danlipsa
Copy link
Contributor

danlipsa commented Nov 8, 2017

... If the value is None, we ca set it in the middle of the domain.

@potter2
Copy link

potter2 commented Nov 8, 2017

honduras

How do I fix the endpoints of the color bar and the colors? I know this is because of the matplotlib color maps but I just want one of the vcs colormaps.

@doutriaux1
Copy link
Contributor Author

which colormap are you using? is it an "old" vcs colormap with reserved colors from 240 to 256?

if so

import vcs
vcs.utils.defaultColorRange = range(16,240)

@potter2
Copy link

potter2 commented Nov 8, 2017

Yes, the old one,. this doesn't work, I still get the blank on each end

sorry to be so dense on this:
import cdms2
import vcs
vcs.utils.defaultColorRange=range(16,240)
f1=cdms2.open('uas_6hr_reanalysis_CFSR_1998010100-1998123118.nc')
f2=cdms2.open('vas_6hr_reanalysis_CFSR_1998010100-1998123118.nc')
u=f1('uas',time=('1998-10-29','1998-10-29','cob'),lat=(12,24),lon=(-96,-82))
v=f2('vas',time=('1998-10-29','1998-10-29','cob'),lat=(12,24),lon=(-96,-82))
u=u/.44704
v=v/.44704
#u=f1('uas',time=('1998-10-29','1998-10-29'))
#v=f2('vas',time=('1998-10-29','1998-10-29'))
x=vcs.init()
x.setcolormap("rainbow")

u.units='mph'

gm=x.createstreamline()
gm.evenlyspaced = False # only available on releases after 2.10 or on the nightly packages.

streamlines are colored by vector magnitude

gm.coloredbyvector = True

We want 10 glyphs(arrows) per streamline

gm.numberofglyphs = 10
gm.filledglyph = True

we place 400 random seeds in a circle that covers the data. This means fewer seeds will be inside the data.

The number of seeds inside the data will result in streamlines.

gm.numberofseeds = 400
gm.evenlyspaced = True # only available only on releases > 2.10 or on the nightly packages

We want the streamline to be about one cell apart from each other

gm.separatingdistance = 1

The seed for the first streamline. All other seeds are generated automatically

gm.startseed = [-90.0, 14.0, 0]

create an evenly spaced streamline plot

x.plot(u, v, gm, bg=1,continents=4,ratio="auto")
#x.plot(u, v, gm, bg=1)
x.png('/home/potter/Desktop/honduras1.png')

@potter2
Copy link

potter2 commented Nov 8, 2017

I'm trying to make a notebook that someone could use to look at local wind (streamlines) at the time of a hurricane eg. the 1998 Honduras hurricane

@doutriaux1
Copy link
Contributor Author

@danlipsa
Copy link
Contributor

danlipsa commented Jan 24, 2018

@doutriaux1 Not sure what is wrong here.

@doutriaux1
Copy link
Contributor Author

having a default to None

@danlipsa
Copy link
Contributor

Oh, yes. Now I remember. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants