xarry netcdf message

2022-08-23 Thread Jorge Conrado Conforte Conforte
Hi,

I'm reading my netcdf data air.2m.mon.ltm.nc.
I used the netcdf4 and I didn't have message when i read my data. But if I
use the xarray I had this message:

/home/conrado/.conda/envs/meuambi/lib/python3.8/site-packages/xarray/backends/plugins.py:61:
RuntimeWarning: Engine 'cfgrib' loading failed:
module 'cfgrib.messages' has no attribute 'DEFAULT_INDEXPATH'
  warnings.warn(f"Engine {name!r} loading failed:\n{ex}", RuntimeWarning)
/home/conrado/.conda/envs/meuambi/lib/python3.8/site-packages/xarray/coding/times.py:673:
SerializationWarning: Unable to decode time axis into full numpy.datetime64
objects, continuing using cftime.datetime objects instead, reason: dates
out of range
  dtype = _decode_cf_datetime_dtype(data, units, calendar, self.use_cftime)
/home/conrado/.conda/envs/meuambi/lib/python3.8/site-packages/xarray/core/indexing.py:423:
SerializationWarning: Unable to decode time axis into full numpy.datetime64
objects, continuing using cftime.datetime objects instead, reason: dates
out of range
  return np.asarray(array[self.key], dtype=None)

What can I do to solve this message.

Thanks,

Conrado
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mutating an HTML file with BeautifulSoup

2022-08-23 Thread Peter J. Holzer
On 2022-08-22 19:27:28 -, Jon Ribbens via Python-list wrote:
> On 2022-08-22, Peter J. Holzer  wrote:
> > On 2022-08-22 00:45:56 -, Jon Ribbens via Python-list wrote:
> >> With the offset though, BeautifulSoup made an arbitrary decision to
> >> use ISO-8859-1 encoding and so when you chopped the bytestring at
> >> that offset it only worked because BeautifulSoup had happened to
> >> choose a 1-byte-per-character encoding. Ironically, *without* the
> >> "\xed\xa0\x80\xed\xbc\x9f" it wouldn't have worked.
> >
> > Actually it would. The unit is bytes if you feed it with bytes, and
> > characters if you feed it with str.
> 
> No it isn't. If you give BeautifulSoup's 'html.parser' bytes as input,
> it first chooses an encoding and decodes the bytes before sending that
> output to html.parser, which is what provides the offset. So the offsets
> it gives are in characters, and you've no simple way of converting that
> back to byte offsets.

Ah, I see. It "worked" for me because "\xed\xa0\x80\xed\xbc\x9f" isn't
valid UTF-8. So Beautifulsoup decided to ignore the "" I had inserted before and used ISO-8859-1, providing
me with correct byte offsets. If I replace that gibberish with a correct
UTF-8 sequence (e.g. "\x4B\xC3\xA4\x73\x65") the UTF-8 is decoded and I
get a character offset.


> >> It looks like BeautifulSoup is doing something like that, yes.
> >> Personally I would be nervous about some of my files being parsed
> >> as UTF-8 and some of them ISO-8859-1 (due to decoding errors rather
> >> than some of the files actually *being* ISO-8859-1 ;-) )
> >
> > Since none of the syntactically meaningful characters have a code >=
> > 0x80, you can parse HTML at the byte level if you know that it's encoded
> > in a strict superset of ASCII (which all of the ISO-8859 family and
> > UTF-8 are). Only if that's not true (e.g. if your files might be UTF-16
> > (or Shift-JIS  or EUC, if I remember correctly) then you have to know
> > the the character set.
> >
> > (By parsing I mean only "create a syntax tree". Obviously you have to
> > know the encoding to know whether to display =ABc3 bc=BB as =AB=FC=BB or =
> >=AB=C3=BC=BB.)
> 
> But the job here isn't to create a syntax tree. It's to change some of
> the content, which for all we know is not ASCII.

We know it's URLs, and the canonical form of an URL is ASCII. The URLs
in the files may not be, but if they aren't you'll have to deal with
variants anyway. And the start and end of the attribute can be
determined in any strict superset of ASCII including UTF-8.

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | [email protected] |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: A new version (0.5.0) of python-gnupg has been released.

2022-08-23 Thread Vinay Sajip via Python-list
What Changed?
=
This is an enhancement and bug-fix release, and all users are encouraged to
upgrade.

Brief summary:

* Fixed #181: Added the ability to pass file paths to encrypt_file, 
decrypt_file,
  sign_file, verify_file, get_recipients_file and added import_keys_file.

* Fixed #183: Handle FAILURE and UNEXPECTED conditions correctly. Thanks to 
sebbASF for
  the patch.

* Fixed #185: Handle VALIDSIG arguments more robustly.

* Fixed #188: Remove handling of DECRYPTION_FAILED from Verify code, as not 
required
  there. Thanks to sebbASF for the patch.

* Fixed #190: Handle KEY_CREATED more robustly.

* Fixed #191: Handle NODATA messages during verification.

* Fixed #196: Don't log chunk data by default, as it could contain sensitive
  information (during decryption, for example).

* Added the ability to pass an environment to the gpg executable. Thanks to 
Edvard
  Rejthar for the patch.

This release [2] has been signed with my code signing key:

Vinay Sajip (CODE SIGNING KEY) 
Fingerprint: CA74 9061 914E AC13 8E66 EADB 9147 B477 339A 9B86

Recent changes to PyPI don't show the GPG signature with the download links.
The source code repository is at [1].
An alternative download source where the signatures are available is at [4].
Documentation is available at [5].

As always, your feedback is most welcome (especially bug reports [3],
patches and suggestions for improvement, or any other points via this group).

Enjoy!

Cheers

Vinay Sajip

[1] https://github.com/vsajip/python-gnupg
[2] https://pypi.org/project/python-gnupg/0.5.0
[3] https://github.com/vsajip/python-gnupg/issues
[4] https://github.com/vsajip/python-gnupg/releases/
[5] https://docs.red-dove.com/python-gnupg/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: xarry netcdf message

2022-08-23 Thread Dioumacor FAYE
Hello, I think you can try this.
I use Python 3.7.11 in jupyter Notebook
import xarray as xr
path = '/media/lpaosf/LPAOSF_DATA/maman/r1mm_r20mm_sdii/
chirps-v2.0.days_p05_r1mm_WA1981-2018.nc'
# Open the NetCDF files in xr.DataSet
r1mm = xr.open_dataset(path)
time=r1mm['time'].data
lon =r1mm['longitude'].data
lat =r1mm['latitude'].data
data_r1mm=r1mm['r1mm'].data

Le mar. 23 août 2022 à 15:38, Jorge Conrado Conforte Conforte <
[email protected]> a écrit :

> Hi,
>
> I'm reading my netcdf data air.2m.mon.ltm.nc.
> I used the netcdf4 and I didn't have message when i read my data. But if I
> use the xarray I had this message:
>
>
> /home/conrado/.conda/envs/meuambi/lib/python3.8/site-packages/xarray/backends/plugins.py:61:
> RuntimeWarning: Engine 'cfgrib' loading failed:
> module 'cfgrib.messages' has no attribute 'DEFAULT_INDEXPATH'
>   warnings.warn(f"Engine {name!r} loading failed:\n{ex}", RuntimeWarning)
>
> /home/conrado/.conda/envs/meuambi/lib/python3.8/site-packages/xarray/coding/times.py:673:
> SerializationWarning: Unable to decode time axis into full numpy.datetime64
> objects, continuing using cftime.datetime objects instead, reason: dates
> out of range
>   dtype = _decode_cf_datetime_dtype(data, units, calendar, self.use_cftime)
>
> /home/conrado/.conda/envs/meuambi/lib/python3.8/site-packages/xarray/core/indexing.py:423:
> SerializationWarning: Unable to decode time axis into full numpy.datetime64
> objects, continuing using cftime.datetime objects instead, reason: dates
> out of range
>   return np.asarray(array[self.key], dtype=None)
>
> What can I do to solve this message.
>
> Thanks,
>
> Conrado
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 
Bien à vous,
---  -
  -
Dioumacor FAYE doctorant au  LPAOSF/ESP/UCAD/BP 5085 Dakar-Fann, Sénégal.
Tel labo: (00221) 33 825 93 64
Email: [email protected]:
+221773475098   +221783484308
Physicien en herbe
Pseudo Skype:   dioumacorfaye
-- 
https://mail.python.org/mailman/listinfo/python-list


INSTALLATION DOES NOT WORK FRO GITBASH COMMAND LINE

2022-08-23 Thread Gladstone Rose
Why is my installation of Python does not work at the command line for git bash.

I get the following message
bash: python3: command not found

Sent from Mail for Windows

-- 
https://mail.python.org/mailman/listinfo/python-list