[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[python #NMJ-899116]: Metpy/Cartopy Issues



Hi!

To get your variables out, you'll have to substitute your variable names, such 
as the one you provided, for the names in the tutorial script. So 
TMP_P0_L100_GLC0 should go in place of Temperature_isobaric. Similarly for the 
rest of the script, you'll have to substitute the variable names for those that 
you have in your data file. The script was set up to work with the example 
dataset and the variable names it contains.

Zach

> Especially with the .nc file having thisÂÂ float TMP_P0_L100_GLC0 ( 
> lv_ISBL0, ygrid_0, xgrid_0 ) as the variable I want.Â
> 
> On Thursday, September 26, 2019, 04:30:16 PM PDT, 

> Okay, I had it partially working but I hit an error withÂKeyError: 
> 'Temperature_isobaric' . I am curious of how I can get the .nc isobaric 
> temperature in the code I sent.Â
> 
> On Thursday, September 26, 2019, 03:41:28 PM PDT, 
> 
> It says 0.10.2ÂÂÂÂ
> 
> On Thursday, September 26, 2019, 03:40:27 PM PDT, Unidata Python Support 
> <address@hidden> wrote:
> 
> Can you see what version of MetPy you upgraded to, by using pip list again?
> This function was added in 0.9, so I suspect it didn't upgrade far enough
> yet.
> 
> Zach
> 
> On Thu, Sep 26, 2019 at 4:35 PM 
> wrote:
> 
> > New Client Reply: Metpy/Cartopy Issues
> >
> > Here is what it shows in my
> > environment--------------------------------------------------------------------------ImportError
> >Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Traceback (most recent call
> > last)C:\Users\jpkal\Downloads\XArray_Projections.py in <module>()Â Â 14
> >Â Â 15 # Any import of metpy will activate the accessors---> 16 from
> > metpy.testing import get_test_data  17   18 ds =
> > xr.open_dataset(get_test_data('narr_example.nc', as_file_obj=False))
> > C:\Users\jpkal\AppData\Local\Enthought\Canopy\User\lib\site-packages\metpy\testing.py
> > in <module>()  19 import xarray as xr  20 ---> 21 from metpy.calc
> > import wind_components  22 from metpy.cbook import get_test_data  23
> > from metpy.deprecation import MetpyDeprecationWarning
> > ImportError: cannot import name wind_components
> > %run
> > "C:\Users\jpkal\Downloads\XArray_Projections.py"---------------------------------------------------------------------------ImportError
> >Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Traceback (most recent call
> > last)C:\Users\jpkal\Downloads\XArray_Projections.py in <module>()Â Â 15
> >Â Â 16 # Any import of metpy will activate the accessors---> 17 from
> > metpy.testing import get_test_data  18   19 ds =
> > xr.open_dataset(get_test_data('narr_example.nc', as_file_obj=False))
> > C:\Users\jpkal\AppData\Local\Enthought\Canopy\User\lib\site-packages\metpy\testing.py
> > in <module>()  19 import xarray as xr  20 ---> 21 from metpy.calc
> > import wind_components  22 from metpy.cbook import get_test_data  23
> > from metpy.deprecation import MetpyDeprecationWarning
> > ImportError: cannot import name wind_components

> >
> >Â Â On Thursday, September 26, 2019, 03:33:57 PM PDT, Unidata Python
> > Support <address@hidden> wrote:
> >
> >Â Ok glad one issue is solved. What's the command you're using to import
> > wind_components? It should be something similar to "from metpy.calc import
> > wind_components".
> >
> > Zach
> >
> > On Thu, Sep 26, 2019 at 4:32 PM 
> > wrote:
> >
> > > New Client Reply: Metpy/Cartopy Issues
> > >
> > > That did the trick but now I am getting this ImportError: cannot import
> > > name wind_components

> > >
> > >Â Â On Thursday, September 26, 2019, 03:05:30 PM PDT, Unidata Python
> > > Support <address@hidden> wrote:
> > >
> > >Â Great, that's the issue! The accessor was added in MetPy v0.8, and we're
> > > currently on version 0.10.2. If you run "pip install --upgrade metpy",
> > this
> > > should upgrade you to 0.10.2. You'll have all of the latest functionality
> > > then, including the xarray accessor. You'll probably want to run this
> > > command regularly to stay up-to-date with future releases (although we
> > will
> > > soon stop support of Python 2.7, so 0.11 will be the last update you can
> > > get until you switch to Python 3). Let us know if you run into any issues
> > > once you update.
> > >
> > > Thanks,
> > > Zach
> > >
> > > On Thu, Sep 26, 2019 at 3:52 PM 
> > >
> > > wrote:
> > >
> > > > New Client Reply: Metpy/Cartopy Issues
> > > >
> > > > It says Metpy 0.5.1
>
> > > >
> > > >Â Â On Thursday, September 26, 2019, 02:50:57 PM PDT, Unidata Python
> > > > Support <address@hidden> wrote:
> > > >
> > > >Â Hi,
> > > >
> > > > Can you run "pip list" on the command line and see the version for
> > > > packages? I'm not familiar with Canopy, but from what I see online,
> > this
> > > > should list all packages available to you. This should yield the
> > version
> > > > info for each package.
> > > >
> > > > Thanks,
> > > > Zach
> > > >
> > address@hidden
> > > >
> > > > wrote:
> > > >
> > > > > New Client Reply: Metpy/Cartopy Issues
> > > > >
> > > > > I tried the commands but I couldn't as I did the pip install on
> > > Enthought
> > > > > Canopy.
> > > > >
> > > > >Â Â On Monday, September 23, 2019, 10:23:28 AM PDT, 
> > > > >
> > > > >Â I wonât be able to get to it for a few days as Iâm on vacation
> > > > >
> > > > >
> > > > > Sent from Yahoo Mail for iPhone
> > > > >
> > > > >
> > > > > address@hidden> wrote:
> > > > >
> > > > > Ok thanks for that info. Also I know you said you installed metpy via
> > > > pip .
> > > > > We have a couple people digging into this to see what's happening.
> > Can
> > > > you
> > > > > confirm the version for us so that we can test things properly on our
> > > > side?
> > > > > You can get it by doing:
> > > > > import metpy
> > > > > print metpy.__version__
> > > > >
> > > > > Thanks,
> > > > > Zach
> > > > >
> > > > > > Python 2.7 I think. I was the one who posted on Stack
> > > > > >
> > > > > >
> > > > > > Sent from Yahoo Mail for iPhone
> > > > > >
> > > > > >
> > > > > address@hidden> wrote:
> > > > > >
> > > > > > Hi!
> > > > > >
> > > > > > Your code looks like it should work. We just had someone else
> > report
> > > > > this same error on StackOverflow, so we're going to dig in more to
> > see
> > > > > what's going on. The only other version item I didn't get from you is
> > > > what
> > > > > version of Python you're using. We will work on this and let you know
> > > > when
> > > > > we figure out what's going on.
> > > > > >
> > > > > > Thanks,
> > > > > > Zach
> > > > > >
> > > > > > > I have tried import metpy but it is still giving me the
> > > > > ( AttributeError: 'Dataset' object has no attribute 'metpy' ) error .
> > I
> > > am
> > > > > curious if you could show me what you did on your end to get it
> > working
> > > > so
> > > > > I could see what my difference is. I have attached my current form fo
> > > the
> > > > > code including the import metpy.
> > > > > > >
> > > > > > > On Friday, September 20, 2019, 12:38:58 PM PDT, wrote:
> > > > > > >
> > > > > > > I think in the code I sent I had it in there
> > > > > > >
> > > > > > >
> > > > > > > Sent from Yahoo Mail for iPhone
> > > > > > >
> > > > > > >
> > > > > address@hidden> wrote:
> > > > > > >
> > > > > > > Thank you for providing the data! That was very helpful.
> > However, I
> > > > > was able to plug it into the code you provided. The only way I was
> > able
> > > > to
> > > > > recreate your problem is if I didn't import anything from MetPy. Then
> > > the
> > > > > code returned the same error you provided. As long as you import
> > > > something
> > > > > from MetPy, the xarray accessor should work.
> > > > > > >
> > > > > > > Zach
> > > > > > >
> > > > > > > > Here is the link to the nc file
> > > > > https://drive.google.com/open?id=1xS_u7hFgLXGVEDCvvWfkrWQiG9fDGfoV
> > > > > > > >
> > > > > > > > On Wednesday, September 18, 2019, 12:28:12 PM PDT,
> > > > > > > > What email can i use to send it.
> > > > > > > >
> > > > > > > > On Wednesday, September 18, 2019, 09:08:51 AM PDT, Unidata
> > Python
> > > > > Support <address@hidden> wrote:
> > > > > > > >
> > > > > > > > > Ok, it shouldn't be xarray, as we test for compatibility, so
> > > > we'll
> > > > > move past that for now. Is there a way to subset this file and
> > provide
> > > it
> > > > > via dropbox/drive/or some other method? Until we're able to recreate
> > it
> > > > on
> > > > > our side, I'm not sure what's going on here, as the same script with
> > a
> > > > > different netCDF file works for me.
> > > > > > > >
> > > > > > > > Thanks,
> > > > > > > > Zach
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Monday, September 16, 2019, 10:44:14 AM PDT,
> > > > > > > > >
> > > > > > > > > I just tried the pip install upgrade but it says that the
> > > 0.11.3
> > > > > is the current one on Canopy.
> > > > > > > > >
> > > > > > > > > On Monday, September 16, 2019, 10:38:03 AM PDT, Unidata
> > Python
> > > > > Support <address@hidden> wrote:
> > > > > > > > >
> > > > > > > > > Thanks for the version information. Could you update xarray
> > to
> > > > the
> > > > > current version (v0.12.3) with pip install --upgrade xarray, and then
> > > > rerun
> > > > > the script? Just trying to see if some kind of incompatibility error
> > > has
> > > > > crept up here.
> > > > > > > > >
> > > > > > > > > Thanks,
> > > > > > > > > Zach
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On Monday, September 16, 2019, 10:32:51 AM PDT,
> > > > > > > > > >
> > > > > > > > > > I'm using the metpy that's available by the pip install
> > > metpy .
> > > > > Xarray is currently at 0.11.3-4
> > > > > > > > > >
> > > > > > > > > > On Monday, September 16, 2019, 10:28:09 AM PDT, Unidata
> > > Python
> > > > > Support <address@hidden> wrote:
> > > > > > > > > >
> > > > > > > > > > Thanks for sending that. This looks identical to the
> > tutorial
> > > > > script (which works for me), at least through line 15. What version
> > of
> > > > > MetPy are you using? Have you tried running the lines in order? If
> > you
> > > > run
> > > > > either line 7 or 9 (the MetPy import statements), then line 15 should
> > > > work.
> > > > > If you run lines 1 to 15 and still get this problem, and are using
> > > MetPy
> > > > > v0.10.2, then we'll work to get a subset of your data maybe. Also
> > > knowing
> > > > > the version of Xarray that you're using may be helpful too.
> > > > > > > > > >
> > > > > > > > > > Thanks,
> > > > > > > > > > Zach
> > > > > > > > > >
> > > > > > > > > > > Here is the code as the nc/grib2files are so big.
> > > > > > > > > > >
> > > > > > > > > > > On Monday, September 16, 2019, 09:44:57 AM PDT, Unidata
> > > > Python
> > > > > Support <address@hidden> wrote:
> > > > > > > > > > >
> > > > > > > > > > > Hi!
> > > > > > > > > > >
> > > > > > > > > > > Can you send your script (if you've modified it from the
> > > > > tutorial posted online) and data (if it's not too big)?
> > Theoretically,
> > > > the
> > > > > MetPy Xarray accessor should be registered once you import anything
> > > from
> > > > > MetPy (like the script does in line 9). So if you run this script
> > from
> > > > top
> > > > > to bottom and you still get this error, that's definitely an issue we
> > > > need
> > > > > to investigate .
> > > > > > > > > > >
> > > > > > > > > > > Zach
> > > > > > > > > > >
> > > > > > > > > > > > I found the cartopy package after I had sent the email.
> > > > > However, a new problem has came up
> > > > > > > > > > > >
> > > > > > > > > > > > Even though I have pip installed metpy.
> > > > > > > > > > > >
> > > > > > > > > > > > |
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > On Thursday, September 12, 2019, 10:27 AM, Unidata
> > Python
> > > > > Support <address@hidden> wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > Hi,
> > > > > > > > > > > >
> > > > > > > > > > > > So the error is complaining about not being able to
> > find
> > > > the
> > > > > GEOS library on your system when it's trying to build CartoPy from
> > > > source .
> > > > > Looking at CartoPy's install instructions:
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > >
> > https://scitools.org.uk/cartopy/docs/latest/installing.html#installing
> > > > > > > > > > > >
> > > > > > > > > > > > It appears that Canopy should have packages for CartoPy
> > > > > available, which I also see in the official Canopy package list:
> > > > > > > > > > > >
> > > > > > > > > > > >
> > https://www.enthought.com/product/canopy/#/package-index
> > > > > > > > > > > >
> > > > > > > > > > > > So my advice would be to use Canopy's installer to
> > > install
> > > > a
> > > > > prebuilt CartoPy package.
> > > > > > > > > > > >
> > > > > > > > > > > > Ryan
> > > > > > > > > > > >
> > > > > > > > > > > > > Hi there, I am trying to follow the xarray with MetPy
> > > > > Tutorial â MetPy 0.10 tutorial. However, I am getting an error about
> > > > > cartopy (Picture attached). I googled and I tried to do pip install
> > > > cartopy
> > > > > but I got another error (Picture also attached). I am curious if
> > there
> > > > is a
> > > > > way to fix this?
> > > > > > > > > > > > >
> > > > > > > > > > > > > |
> > > > > > > > > > > > > |
> > > > > > > > > > > > > |Â |
> > > > > > > > > > > > > xarray with MetPy Tutorial â MetPy 0.10
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > Ticket Details
> > > > > > > > > > > > ===================
> > > > > > > > > > > > Ticket ID: NMJ-899116
> > > > > > > > > > > > Department: Support Python
> > > > > > > > > > > > Priority: Low
> > > > > > > > > > > > Status: Closed
> > > > > > > > > > > > ===================
> > > > > > > > > > > > NOTE: All email exchanges with Unidata User Support are
> > > > > recorded in the Unidata inquiry tracking system and then made
> > publicly
> > > > > available through the web. If you do not want to have your
> > > interactions
> > > > > made available in this way, you must let us know in each email you
> > send
> > > > to
> > > > > us.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Ticket Details
> > > > > > > > > > > ===================
> > > > > > > > > > > Ticket ID: NMJ-899116
> > > > > > > > > > > Department: Support Python
> > > > > > > > > > > Priority: Low
> > > > > > > > > > > Status: Closed
> > > > > > > > > > > ===================
> > > > > > > > > > > NOTE: All email exchanges with Unidata User Support are
> > > > > recorded in the Unidata inquiry tracking system and then made
> > publicly
> > > > > available through the web. If you do not want to have your
> > > interactions
> > > > > made available in this way, you must let us know in each email you
> > send
> > > > to
> > > > > us.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Ticket Details
> > > > > > > > > > ===================
> > > > > > > > > > Ticket ID: NMJ-899116
> > > > > > > > > > Department: Support Python
> > > > > > > > > > Priority: Low
> > > > > > > > > > Status: Closed
> > > > > > > > > > ===================
> > > > > > > > > > NOTE: All email exchanges with Unidata User Support are
> > > > recorded
> > > > > in the Unidata inquiry tracking system and then made publicly
> > available
> > > > > through the web. If you do not want to have your interactions made
> > > > > available in this way, you must let us know in each email you send to
> > > us.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > Ticket Details
> > > > > > > > > ===================
> > > > > > > > > Ticket ID: NMJ-899116
> > > > > > > > > Department: Support Python
> > > > > > > > > Priority: Low
> > > > > > > > > Status: Closed
> > > > > > > > > ===================
> > > > > > > > > NOTE: All email exchanges with Unidata User Support are
> > > recorded
> > > > > in the Unidata inquiry tracking system and then made publicly
> > available
> > > > > through the web. If you do not want to have your interactions made
> > > > > available in this way, you must let us know in each email you send to
> > > us.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > > Ticket Details
> > > > > > > > ===================
> > > > > > > > Ticket ID: NMJ-899116
> > > > > > > > Department: Support Python
> > > > > > > > Priority: Low
> > > > > > > > Status: Closed
> > > > > > > > ===================
> > > > > > > > NOTE: All email exchanges with Unidata User Support are
> > recorded
> > > in
> > > > > the Unidata inquiry tracking system and then made publicly available
> > > > > through the web. If you do not want to have your interactions made
> > > > > available in this way, you must let us know in each email you send to
> > > us.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Ticket Details
> > > > > > > ===================
> > > > > > > Ticket ID: NMJ-899116
> > > > > > > Department: Support Python
> > > > > > > Priority: Low
> > > > > > > Status: Closed
> > > > > > > ===================
> > > > > > > NOTE: All email exchanges with Unidata User Support are recorded
> > in
> > > > > the Unidata inquiry tracking system and then made publicly available
> > > > > through the web. If you do not want to have your interactions made
> > > > > available in this way, you must let us know in each email you send to
> > > us.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > Ticket Details
> > > > > > ===================
> > > > > > Ticket ID: NMJ-899116
> > > > > > Department: Support Python
> > > > > > Priority: Low
> > > > > > Status: Closed
> > > > > > ===================
> > > > > > NOTE: All email exchanges with Unidata User Support are recorded in
> > > the
> > > > > Unidata inquiry tracking system and then made publicly available
> > > through
> > > > > the web. If you do not want to have your interactions made available
> > > in
> > > > > this way, you must let us know in each email you send to us.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > Ticket Details
> > > > > ===================
> > > > > Ticket ID: NMJ-899116
> > > > > Department: Support Python
> > > > > Priority: Low
> > > > > Status: Closed
> > > > > ===================
> > > > > NOTE: All email exchanges with Unidata User Support are recorded in
> > the
> > > > > Unidata inquiry tracking system and then made publicly available
> > > through
> > > > > the web. If you do not want to have your interactions made available
> > > in
> > > > > this way, you must let us know in each email you send to us.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Ticket Details
> > > > > ===================
> > > > > Ticket ID: NMJ-899116
> > > > > Department: Support Python
> > > > > Priority: Low
> > > > > Status: Open
> > > > > Link:
> > > > >
> > > >
> > >
> > https://andy.unidata.ucar.edu/staff/index.php?_m=tickets&_a=viewticket&ticketid=30704
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > Ticket Details
> > > > ===================
> > > > Ticket ID: NMJ-899116
> > > > Department: Support Python
> > > > Priority: Low
> > > > Status: Open
> > > > ===================
> > > > NOTE: All email exchanges with Unidata User Support are recorded in the
> > > > Unidata inquiry tracking system and then made publicly available
> > through
> > > > the web. If you do not want to have your interactions made available
> > in
> > > > this way, you must let us know in each email you send to us.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Ticket Details
> > > > ===================
> > > > Ticket ID: NMJ-899116
> > > > Department: Support Python
> > > > Priority: Low
> > > > Status: Open
> > > > Link:
> > > >
> > >
> > https://andy.unidata.ucar.edu/staff/index.php?_m=tickets&_a=viewticket&ticketid=30704
> > > >
> > > >
> > >
> > >
> > >
> > > Ticket Details
> > > ===================
> > > Ticket ID: NMJ-899116
> > > Department: Support Python
> > > Priority: Low
> > > Status: Open
> > > ===================
> > > NOTE: All email exchanges with Unidata User Support are recorded in the
> > > Unidata inquiry tracking system and then made publicly available through
> > > the web. If you do not want to have your interactions made available in
> > > this way, you must let us know in each email you send to us.
> > >
> > >
> > >
> > >
> > >
> > > Ticket Details
> > > ===================
> > > Ticket ID: NMJ-899116
> > > Department: Support Python
> > > Priority: Low
> > > Status: Open
> > > Link:
> > >
> > https://andy.unidata.ucar.edu/staff/index.php?_m=tickets&_a=viewticket&ticketid=30704
> > >
> > >
> >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: NMJ-899116
> > Department: Support Python
> > Priority: Low
> > Status: Open
> > ===================
> > NOTE: All email exchanges with Unidata User Support are recorded in the
> > Unidata inquiry tracking system and then made publicly available through
> > the web. If you do not want to have your interactions made available in
> > this way, you must let us know in each email you send to us.
> >
> >
> >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: NMJ-899116
> > Department: Support Python
> > Priority: Low
> > Status: Open
> > Link:
> > https://andy.unidata.ucar.edu/staff/index.php?_m=tickets&_a=viewticket&ticketid=30704
> >
> >
> 
> 
> 
> Ticket Details
> ===================
> Ticket ID: NMJ-899116
> Department: Support Python
> Priority: Low
> Status: Open
> ===================
> NOTE: All email exchanges with Unidata User Support are recorded in the 
> Unidata inquiry tracking system and then made publicly available through the 
> web. If you do not want to have your interactions made available in this 
> way, you must let us know in each email you send to us.
> 
> 
> 
> 


Ticket Details
===================
Ticket ID: NMJ-899116
Department: Support Python
Priority: Low
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.