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

[python #MZO-814691]: Re: Returned mail: see transcript for details



Hi!

Glad to hear it's working for you now. Let us know if you run into any
further issues!

Zach

On Fri, Oct 4, 2019 at 11:16 AM  <address@hidden> wrote:

> New Client Reply: Re: Returned mail: see transcript for details
>
> >
> >
> >
> > ---------- Forwarded message ----------
> > To: address@hidden
> > Cc:
> > Bcc:
> > Date: Fri, 4 Oct 2019 09:51:10 -0700
> > Subject: Re: [python #MZO-814691]: Re: Returned mail: see transcript for
> > details
> > Please forgive me or being an idiot! I stupidly had left [0] in the code.
> > Removed those and returns all levels now.
> > Thanks
> >
> > On Thu, Oct 3, 2019 at 1:04 PM:
> >
> >> Thanks a lot - I have not used tile before and seems to work well to
> make
> >> pressure a 3D variable. So I parse 3D temp, pressure and specific
> humidity
> >> to the function mpcalc.dewpoint_from_specific_humidity but still only
> get
> >> returned a 2D array (lat and lon, no levels).
> >> I can add a loop for now, which will solve it.
> >> Thanks,
> >>
> >>
> >> address@hidden> wrote:
> >>
> >>> Yeah, we had to change around how our email server worked and
> apparently
> >>> it's causing occasional issues like you're experiencing. To solve the
> >>> problem you mentioned, you need to tile pressure into 3-D.
> >>>
> >>> p=dataset['T'].lev # 42 levels
> >>> p = np.tile(p, 91*89).reshape(42, 91, 89) * units.hPa
> >>>
> >>> Then it should have the same shape as your other variables that are
> >>> already 3-D.
> >>>
> >>> Zach
> >>>
> >>> > Hi,
> >>> > Weird that sometimes I get this error when trying to send you
> emails?!
> >>> > One final question - as I just said a minute ago I do not get errors,
> >>> but
> >>> > the mpcalc.dewpoint_from_specific_humidity does not return multiple
> >>> levels.
> >>> > I am giving it specific humidity with 42 levs, T with 42 levs and P
> >>> with 42
> >>> > levs but get back a simple 2D array with the shape of lat and lon and
> >>> no
> >>> > levels.
> >>> > Do I need to loop through all levels or is there something less messy
> >>> I can
> >>> > do?
> >>> > Thanks a lot,
> >>>
> >>> >
> >>> > sh=dataset['QV'] # 42,91,89
> >>> > t=dataset['T'] # Kelvin 42,91,89
> >>> >
> >>> > t.metpy.convert_units('degC')
> >>> >
> >>> > # need pressure with height
> >>> > p=dataset['T'].lev # 42 levels
> >>> >
> >>> > #### RETURNS shape 91,89
> >>> > dataset['Tdew_lev'] = mpcalc.dewpoint_from_specific_humidity(sh[0],
> >>> > t[0], p[0])
> >>> >
> >>> > address@hidden> wrote:
> >>> >
> >>> > > The original message was received at Thu, 3 Oct 2019 10:28:46 -0700
> >>> > > from m0151358.ppops.net [127.0.0.1]
> >>> > >
> >>> > >    ----- The following addresses had permanent fatal errors -----
> >>> > > <address@hidden>
> >>> > >     (reason: 554 5.7.1 Service unavailable; Client host
> >>> [148.163.141.31]
> >>> > > blocked using all.s5h.net; See http://s5h.net/rbl)
> >>> > >
> >>> > >    ----- Transcript of session follows -----
> >>> > > ... while talking to smtp.unidata.ucar.edu.:
> >>> > > >>> DATA
> >>> > > <<< 554 5.7.1 Service unavailable; Client host [148.163.141.31]
> >>> blocked
> >>> > > using all.s5h.net; See http://s5h.net/rbl
> >>> > > 554 5.0.0 Service unavailable
> >>> > > <<< 554 5.5.1 Error: no valid recipients
> >>> > >
> >>> > >
> >>> > >
> >>> > > ---------- Forwarded message ----------
> >>> > > To: address@hidden
> >>> > > Cc:
> >>> > > Bcc:
> >>> > > Date: Thu, 3 Oct 2019 10:28:32 -0700
> >>> > > Subject: Re: [python #MZO-814691]: Re: Returned mail: see
> transcript
> >>> for
> >>> > > details
> >>> > > Great, thanks, this works without error now:
> >>> > >
> >>> > >     dataset['QV'].attrs['units'] = 'dimensionless'
> >>> > >
> >>> > >     sh=dataset['QV'] # 42,91,89
> >>> > >     t=dataset['T'] # Kelvin 42,91,89
> >>> > >
> >>> > >     t.metpy.convert_units('degC')
> >>> > >
> >>> > >     # need pressure with height
> >>> > >     p=dataset['T'].lev # 42 levels
> >>> > >
> >>> > >     dataset['Tdew'] = mpcalc.dewpoint_from_specific_humidity(sh[0],
> >>> t[0],
> >>> > > p[0])
> >>> > >
> >>> > >     dataset['T-Tdew'] = t-dataset['Tdew']
> >>> > >
> >>> > > address@hidden> wrote:
> >>> > >
> >>> > >> Hi!
> >>> > >>
> >>> > >> The syntax using Xarray would be:
> >>> > >>
> >>> > >> dataset['QV'].attrs['units'] = 'dimensionless'
> >>> > >>
> >>> > >> Hope that helps!
> >>> > >> Zach
> >>> > >>
> >>> > >> > Hi,
> >>> > >> > Can you please just clarify the syntax I need to convert from
> >>> units of
> >>> > >> 'kg
> >>> > >> > kg-1' to '1'?
> >>> > >> > Thanks a lot,
> >>> > >>
> >>> > >> >
> >>> > >> > On Wed, Oct 2, 2019 at 1:28 PM wrote:
> >>> > >> >
> >>> > >> > > Hi,
> >>> > >> > > Here is a link to the data. There is a '_flx' file where there
> >>> are the
> >>> > >> > > QLML and TLML and PS variables that I use to calculate at the
> >>> > >> surface. In
> >>> > >> > > the other file are data on multiple levels.
> >>> > >> > > The 2 functions are below. _surface works fine but I get an
> >>> error for
> >>> > >> > > _levels.
> >>> > >> > >
> >>> > >> > > Thanks a lot,
> >>> > >>
> >>> > >> > >
> >>> > >> > >
> >>> > >> > >
> >>> > >> > >
> >>> > >> > >
> >>> > >> > >
> >>> > >> > > # calculate dew point temperature
> >>> > >> > >
> >>> > >> > > def get_dew_surface(dataset):
> >>> > >> > >     #mpcalc.dewpoint_from_specific_humidity(specific_humidity,
> >>> > >> > > temperature, pressure)
> >>> > >> > >     #QLML and TLML shape 91, 89 lat 15 to 60. lon -170 to -115
> >>> > >> > >     #SLP shape 90, 88 lat 15 to 59.5. lon -170 to -115.6
> >>> > >> > >
> >>> > >> > >     sh=dataset['QLML']
> >>> > >> > >     t=dataset['TLML'] # Kelvin
> >>> > >> > >
> >>> > >> > >     t.metpy.convert_units('degC')
> >>> > >> > >
> >>> > >> > >
> >>> > >> > >     p=dataset['PS']
> >>> > >> > >
> >>> > >> > >     dataset['Tdew'] =
> >>> mpcalc.dewpoint_from_specific_humidity(sh, t, p)
> >>> > >> > >
> >>> > >> > >
> >>> > >> > >     ## if temperature is less than dew point temperature, get
> >>> > >> condensation
> >>> > >> > >
> >>> > >> > >     dataset['T-Tdew'] = t-dataset['Tdew']
> >>> > >> > >
> >>> > >> > >     return
> >>> > >> > >
> >>> > >> > >
> >>> > >> > >
> >>> > >> > > # dew point vertical profile
> >>> > >> > > def get_dew_levels(dataset):
> >>> > >> > >     #mpcalc.dewpoint_from_specific_humidity(specific_humidity,
> >>> > >> > > temperature, pressure)
> >>> > >> > >     #QLML and TLML shape 91, 89 lat 15 to 60. lon -170 to -115
> >>> > >> > >     #SLP shape 90, 88 lat 15 to 59.5. lon -170 to -115.6
> >>> > >> > >
> >>> > >> > >     sh=dataset['QV'] # 42,91,89
> >>> > >> > >     t=dataset['T'] # Kelvin 42,91,89
> >>> > >> > >
> >>> > >> > >     t.metpy.convert_units('degC')
> >>> > >> > >
> >>> > >> > >     # need pressure with height
> >>> > >> > >     p=dataset['T'].lev # 42 levels
> >>> > >> > >
> >>> > >> > >     dataset['Tdew'] =
> >>> mpcalc.dewpoint_from_specific_humidity(sh[0],
> >>> > >> t[0],
> >>> > >> > > p[0])
> >>> > >> > >
> >>> > >> > >     ## if temperature is less than dew point temperature, get
> >>> > >> condensation
> >>> > >> > >
> >>> > >> > >     dataset['T-Tdew'] = t-dataset['Tdew']
> >>> > >> > >
> >>> > >> > >     return
> >>> > >> > >
> >>> > >> > >
> >>> > >> > >
> >>> > >> > >
> >>> > >> > >
> >>> > >> > >
> >>> > >> > >
> >>> > >> > >
> >>> > >> > > address@hidden> wrote:
> >>> > >> > >
> >>> > >> > >> Hi!
> >>> > >> > >>
> >>> > >> > >> Sounds like the units in your file are a little funky. Is
> >>> there any
> >>> > >> chance
> >>> > >> > >> that you could provide a link to the data (Drive/Dropbox) so
> >>> that I
> >>> > >> could
> >>> > >> > >> play with it and see how to get around this error? I can get
> >>> you a
> >>> > >> more
> >>> > >> > >> exact answer if I can get eyes on it. Otherwise, if you know
> >>> what the
> >>> > >> > >> units
> >>> > >> > >> should be, you can manually assign the units by stripping and
> >>> > >> reattaching
> >>> > >> > >> (variable.magnitude * units.whatever) and then passing that
> >>> into the
> >>> > >> > >> function. It's somewhat surprising though that the (kg/kg)
> >>> units
> >>> > >> aren't
> >>> > >> > >> being handled correctly, which is why I would like to see it
> in
> >>> > >> person to
> >>> > >> > >> see if we have a bug somewhere.
> >>> > >> > >>
> >>> > >> > >> Thanks,
> >>> > >> > >> Zach
> >>> > >> > >>
> >>> address@hidden>
> >>> > >> wrote:
> >>> > >> > >>
> >>> > >> > >> > New Ticket: Re: Returned mail: see transcript for details
> >>> > >> > >> >
> >>> > >> > >> > > ---------- Forwarded message ----------
> >>> > >> > >> > > To: address@hidden
> >>> > >> > >> > > Cc:
> >>> > >> > >> > > Bcc:
> >>> > >> > >> > > Date: Fri, 27 Sep 2019 11:06:24 -0700
> >>> > >> > >> > > Subject: specific humidity units
> >>> > >> > >> > invmpcalc.dewpoint_from_specific_humidity
> >>> > >> > >> > > Hi,
> >>> > >> > >> > > I am using mpcalc.dewpoint_from_specific_humidity
> >>> successfully
> >>> > >> when I
> >>> > >> > >> use
> >>> > >> > >> > > surface values of specific humidity, temperature and
> >>> pressure.
> >>> > >> > >> However,
> >>> > >> > >> > > when I want to compute this on multiple levels I get this
> >>> error:
> >>> > >> > >> > >
> >>> > >> > >> > > DimensionalityError: Cannot convert from 'kilogram ** 2'
> to
> >>> > >> > >> > 'dimensionless'
> >>> > >> > >> > >
> >>> > >> > >> > > I have looked into the data that I put straight into
> >>> xarrays from
> >>> > >> > >> > > downloading the raw data and the surface specific
> humidity
> >>> has
> >>> > >> units
> >>> > >> > >> of
> >>> > >> > >> > '1'
> >>> > >> > >> > > and the specific humidity on multiple levels has units of
> >>> > >> 'kg/kg'.
> >>> > >> > >> > >
> >>> > >> > >> > > Do you know how I can get around this error?
> >>> > >> > >> > >
> >>> > >> > >> > > Thanks a lot,
> >>> > >> > >> >
> >>> > >> > >> > Ticket Details
> >>> > >> > >> > ===================
> >>> > >> > >> > Ticket ID: MZO-814691
> >>> > >> > >> > Department: Support Python
> >>> > >> > >> > Priority: Low
> >>> > >> > >> > Status: Open
> >>> > >> > >> > Link:
> >>> > >> > >> >
> >>> > >> > >>
> >>> > >>
> >>>
> https://andy.unidata.ucar.edu/staff/index.php?_m=tickets&_a=viewticket&ticketid=30747
> >>> > >> > >> > ===================
> >>> > >> > >> > 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: MZO-814691
> >>> > >> > >> 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: MZO-814691
> >>> > >> 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: MZO-814691
> >>> 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.
> >>>
> >>>
> >>>
> >>
> >> --
> >> Alison Cobb
> >> Postdoctoral Scholar
> >> Center for Western Weather and Water Extremes
> >>
> >> 858-534-1819
> >> address@hidden
> >>
> >
> >
> > --
> > Alison Cobb
> > Postdoctoral Scholar
> > Center for Western Weather and Water Extremes
> >
> > 858-534-1819
> > address@hidden
> >
>
>
> --
> Alison Cobb
> Postdoctoral Scholar
> Center for Western Weather and Water Extremes
>
> 858-534-1819
> address@hidden
>
>
>
> Ticket Details
> ===================
> Ticket ID: MZO-814691
> Department: Support Python
> Priority: Low
> Status: Open
> Link:
> https://andy.unidata.ucar.edu/staff/index.php?_m=tickets&_a=viewticket&ticketid=30747
>
>



Ticket Details
===================
Ticket ID: MZO-814691
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.