Some problems with ninjotiff

148 views
Skip to first unread message

張伯誠

unread,
Feb 23, 2014, 8:39:12 PM2/23/14
to pyt...@googlegroups.com
Hello, everyone.

I want to save some extra data, such as brightness temperature, reflecrance, in tiff format, it seems the ninjotiff can satisfy that work.

However, I have some problems with ninjotif.

According to the post: https://groups.google.com/forum/#!searchin/pytroll/tiff/pytroll/4ACdUPUh9YU/63XXAEpuKmYJ

***
MPOP's geo_image save then, goes like:
geo_image.save(filename,
               fformat='mpop.imageo.formats.ninjotiff',
               ninjo_product_name=ninjo_product_name)

***

but it doesn't work...the error message is still : mpop.imageo.image.UnknownImageFormat: Unknown image format 'ninjotiff'.

Hence, I try an other approach to use the ninjotiff.py as following:

img=GeoImage(local_data[10.8].data, local_data[10.8].area, local_time.time_slot, fill_value=0,mode="L")
img.enhance(stretch="crude")
ninjotiff.save(img, "noaa_sample.tif")


it can run, but have very many error messages. It always run into another error while you solve one....

So, how to use this ninjotiff.py?

Thanks in advance.


Bocheng


Martin Raspaud

unread,
Feb 24, 2014, 8:18:58 AM2/24/14
to pyt...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 24/02/14 02:39, 張伯誠 wrote:
> Hello, everyone.
>
> I want to save some extra data, such as brightness temperature,
> reflecrance, in tiff format, it seems the ninjotiff can satisfy
> that work.

Hello Bocheng,

I don't know much about ninjo tiff myself, but from what I gather it
is basically geotiff with some extra tags for the Ninjo software. So
if you're not using Ninjo, I suppose there is no need to use this format.

For your problem (saving IR BT in tiff), you could just use mpop's
save method like this:

geo_image.save(filename, floating_point=True)

Or was it something else you needed ?

Best regards,
Martin



> However, I have some problems with ninjotif.
>
> According to the post:
> https://groups.google.com/forum/#!searchin/pytroll/tiff/pytroll/4ACdUPUh9YU/63XXAEpuKmYJ
>
>
>
*** MPOP's geo_image save then, goes like:
> geo_image.save(filename, fformat='mpop.imageo.formats.ninjotiff',
> ninjo_product_name=ninjo_product_name)
>
> ***
>
> but it doesn't work...the error message is still :
> mpop.imageo.image.UnknownImageFormat: Unknown image format
> 'ninjotiff'.
>
> Hence, I try an other approach to use the ninjotiff.py as
> following:
>
> img=GeoImage(local_data[10.8].data, local_data[10.8].area,
> local_time.time_slot, fill_value=0,mode="L")
> img.enhance(stretch="crude") ninjotiff.save(img,
> "noaa_sample.tif")
>
>
> it can run, but have very many error messages. It always run into
> another error while you solve one....
>
> So, how to use this ninjotiff.py?
>
> Thanks in advance.
>
>
> Bocheng
>
>
> -- You received this message because you are subscribed to the
> Google Groups "pytroll" group. To unsubscribe from this group and
> stop receiving emails from it, send an email to
> pytroll+u...@googlegroups.com. For more options, visit
> https://groups.google.com/groups/opt_out.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTC0bCAAoJEBdvyODiyJI4XQAIAL7BwvJHvB5Agi/AYF9tXTF2
bCto//VXZFNsVI08/x0S/KhMjy3atVndbAvvEt6Ie/JYf/zMJz3NPmXLuO9sm733
N555IjPqZQ3eJPnmj+AKN7bt/9JLMR99LlEvGzRn4N7TS6kINuBaQwSOtm+uCrkx
QJmTW9lhukZIwAqijRUGq3V+XeXdCy7oZRRgQHdlyI2y5Sn09OTIsrvmwl3fAihB
bT3V/cSkPQaQIUWDKlce0mwLyHXhvQkRcZO3qY2U1ca4NFjwww46Z/QpL6Rmkm2t
Sr0UR2LMnlxtA4JazZ3x7XbxdmTik0euj8VuWly3Z7SxGVapU5jE3GCyI9EkDU4=
=2jB+
-----END PGP SIGNATURE-----
martin_raspaud.vcf

Martin Raspaud

unread,
Feb 24, 2014, 8:19:03 AM2/24/14
to pyt...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 24/02/14 02:39, 張伯誠 wrote:
> Hello, everyone.
>
> I want to save some extra data, such as brightness temperature,
> reflecrance, in tiff format, it seems the ninjotiff can satisfy
> that work.

Hello Bocheng,

I don't know much about ninjo tiff myself, but from what I gather it
is basically geotiff with some extra tags for the Ninjo software. So
if you're not using Ninjo, I suppose there is no need to use this format.

For your problem (saving IR BT in tiff), you could just use mpop's
save method like this:

geo_image.save(filename, floating_point=True)

Or was it something else you needed ?

Best regards,
Martin



> However, I have some problems with ninjotif.
>
> According to the post:
> https://groups.google.com/forum/#!searchin/pytroll/tiff/pytroll/4ACdUPUh9YU/63XXAEpuKmYJ
>
>
>
>
*** MPOP's geo_image save then, goes like:
> geo_image.save(filename, fformat='mpop.imageo.formats.ninjotiff',
> ninjo_product_name=ninjo_product_name)
>
> ***
>
> but it doesn't work...the error message is still :
> mpop.imageo.image.UnknownImageFormat: Unknown image format
> 'ninjotiff'.
>
> Hence, I try an other approach to use the ninjotiff.py as
> following:
>
> img=GeoImage(local_data[10.8].data, local_data[10.8].area,
> local_time.time_slot, fill_value=0,mode="L")
> img.enhance(stretch="crude") ninjotiff.save(img,
> "noaa_sample.tif")
>
>
> it can run, but have very many error messages. It always run into
> another error while you solve one....
>
> So, how to use this ninjotiff.py?
>
> Thanks in advance.
>
>
> Bocheng
>
>
> -- You received this message because you are subscribed to the
> Google Groups "pytroll" group. To unsubscribe from this group and
> stop receiving emails from it, send an email to
> pytroll+u...@googlegroups.com. For more options, visit
> https://groups.google.com/groups/opt_out.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTC0bHAAoJEBdvyODiyJI42SkIALWjJ6Rn4kAtRnCmWltrDRa9
0mB9EqXtOwYtbArQe/XnzgdJ+7V3P1LgGhF4GWLXHHLc/BB++02xr+aU2VVX3TxC
52H2q1htX6eqWc5KTXX1049FAMMmn7LFwoQE78bl9p5J7QYmp29xDI3KIls64g/a
1Vb/2ltGRaf7fm6KLwxDkD3OgdmVFJlcDk++q9bNwk3c0id+ObGutF1bSLRvJAzQ
4FzCD7YPL5dns8epe+koIn3tvCfInzBNNcD6ALyku6VLXVqH4cOPyamRQIxgJVl+
1TcKaUoAUn/08a9/E9w7Cy+nGEEELL+ixFIjxRB/Xtt+j46Tf6DFhPXuUJHZIo8=
=+cBJ
-----END PGP SIGNATURE-----
martin_raspaud.vcf

張伯誠

unread,
Feb 25, 2014, 9:29:09 PM2/25/14
to pyt...@googlegroups.com, martin....@smhi.se


Martin Raspaud於 2014年2月24日星期一UTC+8下午9時18分58秒寫道:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 24/02/14 02:39, 張伯誠 wrote:
> Hello, everyone.
>
> I want to save some extra data, such as brightness temperature,
> reflecrance, in tiff format, it seems the ninjotiff can satisfy
> that work.

Hello Bocheng,

I don't know much about ninjo tiff myself, but from what I gather it
is basically geotiff with some extra tags for the Ninjo software. So
if you're not using Ninjo, I suppose there is no need to use this format.

For your problem (saving IR BT in tiff), you could just use mpop's
save method like this:

geo_image.save(filename, floating_point=True)

Or was it something else you needed ?

Best regards,
Martin


Hello, Martin.

Yes, that is exactly what I need.

But could the BT value be represented in original value not the normalized value(0.0~1.0)?


Bocheng
 

Martin Raspaud

unread,
Feb 26, 2014, 12:04:11 PM2/26/14
to pyt...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Bocheng,

>> Hello, Martin.
>
>> Yes, that is exactly what I need.
>
>> But could the BT value be represented in original value not the
>> normalized value(0.0~1.0)?

yes, of course:

img = global_data.image(10.8, mode="L")
img.save("float.tif", floating_point=True)

I ran into problems myself when doing this with the latest pre-master
mpop, so I pushed some changes. Be sure to pull the latest changes if
you get into trouble !

Also, I wanted to point out that we use here netcdf to save satellite
data. It's as easy as global_data.save("my_data.nc") :)
We consider Geotiff more as an image format than a container for data.
But your use case is probably different of course.

Best regards,
Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTDh6KAAoJEBdvyODiyJI4o60IAKGNY/bDO3/KAvLCCrgpBlX3
ZjS81Z1rbppeqDADuquXjsztUKHbxuOTx4WUSthlympXKNcgeHHbeE5bOIF1Y39u
EU9/+/pnBFvMRM2tJbDzZiionYvTEDdezkxcjVOER2uv5Y0x+C3wewAQZAcSxs+p
SnsY/p3FIpvBep0z1FhCJ1hHINXfiN/13B1aY2lC/NHJ4ePB7zBgBtc2Fa/im/Tc
vzsJpeW4U6RgsQO8jAIu6sD6IafktpwpQs1m6qLtSvFgNdFKm1ueuwNR858HK181
b8o4CfYT8Vo+e743XmH22vp6/92jF05Lsz7GVqDzS0A4XrEryEPZG/4gzrrTrBw=
=I5i1
-----END PGP SIGNATURE-----
martin_raspaud.vcf

張伯誠

unread,
Feb 26, 2014, 10:07:12 PM2/26/14
to pyt...@googlegroups.com, martin....@smhi.se


Martin Raspaud於 2014年2月27日星期四UTC+8上午1時04分11秒寫道:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Bocheng,

>> Hello, Martin.
>
>> Yes, that is exactly what I need.
>
>> But could the BT value be represented in original value not the
>> normalized value(0.0~1.0)?

yes, of course:

img = global_data.image(10.8, mode="L")
img.save("float.tif", floating_point=True)

Martin,

Thank you very much for this fix, now it works very well for saving BT, IR in orginal value.

I have some other problems:

If using the stretch option, for example, stretch="crude" or add_overlay method, the first will result in data normalized, the later will run into IndexError,

Are they features or bugs?


Bocheng

 

Martin Raspaud

unread,
Feb 27, 2014, 4:32:49 AM2/27/14
to pyt...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 27/02/14 04:07, 張伯誠 wrote:
>> Martin,
>
>> Thank you very much for this fix, now it works very well for
>> saving BT, IR in orginal value.
>
>> I have some other problems:
>
>> If using the stretch option, for example, stretch="crude" or
>> add_overlay method, the first will result in data normalized, the
>> later will run into IndexError,
>
>> Are they features or bugs?

Bocheng,

I think the first one is a feature: mpop considers that valid values
for color channels are between 0 and 1.
The second one looks like a bug. Could you post some code to reproduce
the error, please ?

Best regards,
Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTDwZBAAoJEBdvyODiyJI4IkIIAImADimd4UBloiHNIckBhH0s
wf2ctFgC0OTLpMcDli7gxsQZl8ar2t7N1h/7ftDCuz6IMRM3MbESpZY2cMGV+qjA
G27NqfHKJmNI59EwNLyhU+CKZ+No0beO3c1VCzWFQNL65qtIE3CSNIAG93aGgKqe
IYI2FmXTiTdgce0Thvg0iW/b0CYwWl2RH/mjtn++qAQeVdCr5q2k35IyjCtpEqze
wnD/g2YzSp531K101sRAiVkEYWu4wmHKxoyLMizW1GHuvjGsMs3d/moISZ4hEOIl
0tVL8PnX/kUYXGlH79xzPSFMKDipa1X3NPDCmaRnfsIqKE5Zc2Y1ojWAuEo11rs=
=2Lnh
-----END PGP SIGNATURE-----
martin_raspaud.vcf

張伯誠

unread,
Feb 27, 2014, 6:56:49 AM2/27/14
to pyt...@googlegroups.com, martin....@smhi.se


Martin Raspaud於 2014年2月27日星期四UTC+8下午5時32分49秒寫道:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 27/02/14 04:07, 張伯誠 wrote:
>> Martin,
>
>> Thank you very much for this fix, now it works very well for
>> saving BT, IR in orginal value.
>
>> I have some other problems:
>
>> If using the stretch option, for example, stretch="crude" or
>> add_overlay method, the first will result in data normalized, the
>> later will run into IndexError,
>
>> Are they features or bugs?

Bocheng,

I think the first one is a feature: mpop considers that valid values
for color channels are between 0 and 1.
 
oh, I see. Thank you.
 
The second one looks like a bug. Could you post some code to reproduce
the error, please ?

Yes, of course, but I am off duty and have a holiday tomorrow. I will post my code here next Monday.


Bocheng

張伯誠

unread,
Mar 2, 2014, 11:05:46 PM3/2/14
to pyt...@googlegroups.com, martin....@smhi.se


Martin Raspaud於 2014年2月27日星期四UTC+8下午5時32分49秒寫道:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 27/02/14 04:07, 張伯誠 wrote:
>> Martin,
>
>> Thank you very much for this fix, now it works very well for
>> saving BT, IR in orginal value.
>
>> I have some other problems:
>
>> If using the stretch option, for example, stretch="crude" or
>> add_overlay method, the first will result in data normalized, the
>> later will run into IndexError,
>
>> Are they features or bugs?

Bocheng,

I think the first one is a feature: mpop considers that valid values
for color channels are between 0 and 1.
The second one looks like a bug. Could you post some code to reproduce
the error, please ?

Hello Martin,

my code is as followings:

global_data.load([10.8])
local_data=global_data.project("my_area",mode="nearset")
img=local_data.image(10.8,mode="L")
img.add_overlay()
img.save("noaa_test.tif",floating_point=True)


The error message is:
IndexError: 0-d arrays can only use a single () or a list of newaxes (and a single ...) as an index

How to fix it?

Bocheng
 

張伯誠

unread,
Mar 3, 2014, 2:50:51 AM3/3/14
to pyt...@googlegroups.com, martin....@smhi.se


Martin Raspaud於 2014年2月27日星期四UTC+8上午1時04分11秒寫道:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Bocheng,

>> Hello, Martin.
>
>> Yes, that is exactly what I need.
>
>> But could the BT value be represented in original value not the
>> normalized value(0.0~1.0)?

yes, of course:

img = global_data.image(10.8, mode="L")
img.save("float.tif", floating_point=True)

I ran into problems myself when doing this with the latest pre-master
mpop, so I pushed some changes. Be sure to pull the latest changes if
you get into trouble !

Also, I wanted to point out that we use here netcdf to save satellite
data. It's as easy as global_data.save("my_data.nc") :)

Martin, I have tried this way last week, and tried it again today, but my ncdump  can't read my netcdf files...

my ncdump -V is: ncdump,  HDF Version 4.2 Release 9, February 7, 2013
the error message is: ncdump: ncopen failed on noaa19_sample.nc

my code is :
global_data=PolarFactory.create_scene("noaa","19","avhrr",time_slot,orbit)  # if use npp viirs , the result is still the same...
global_data.load([10.8])
local_data=global_data.project("my_area",mode="nearest")
local_data.save("noaa_sample.nc")

Can your ncdump read netcdf files?

Bocheng


Martin Raspaud

unread,
Mar 3, 2014, 3:58:51 AM3/3/14
to pyt...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Bocheng,

>> Martin, I have tried this way last week, and tried it again
>> today, but my ncdump can't read my netcdf files...
>
>> my ncdump -V is: ncdump, HDF Version 4.2 Release 9, February 7,
>> 2013 the error message is: ncdump: ncopen failed on
>> noaa19_sample.nc
>
>> my code is :
>> global_data=PolarFactory.create_scene("noaa","19","avhrr",time_slot,orbit)
>> # if use npp viirs , the result is still the same...
>> global_data.load([10.8])
>> local_data=global_data.project("my_area",mode="nearest")
>> local_data.save("noaa_sample.nc")
>
>> Can your ncdump read netcdf files?

Yes I have no problem reading the files with ncdump. My version is:
"netcdf library version 4.1.1 of Jan 30 2014 05:31:22 $" on our RHEL6.5

Another thing you can try is to open your file with h5dump, that
should work...
Otherwise, you could also send me you sample netcdf file, see if I can
read it.

By the way, I fixed a couple of bugs in mpop while testing the netcdf
saving, maybe this can make a difference ? Check out the pre-master
branch if you want to test it.

Best regards,
Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTFERLAAoJEBdvyODiyJI4hwkIAKSFK+tDm/p0tJS1MLAu5ppU
8n3zfbv8JGKf1T6FFk4D57ra0gcuQ52qDP9FJJDLiEmYH2IYgiGIguX5XaIyunoc
EXUTODdBzORJQDO6/8A4LAnjfvZYMZ16CG+BAADHCAMTRMLAEB8VPowY1RnN8IZr
Xk3th2+XaW0IbUFVDqyleJELrW2CKdEnoBCW1GOvTyYPHMJEKdmLh9oqmW30pfbD
YeJE/Ul9sc+Srq2Qkegbw1Cjs7opKTUHN+51a6ZyS0QvpKZWg7XuztQ5wTq5fZpk
o1VdU3ki4VtJ2t2hiUsAgiIEUvaVRrXlGIGWouvIlyREgPgHjt38cACf3OfLHZc=
=5oYA
-----END PGP SIGNATURE-----
martin_raspaud.vcf

Martin Raspaud

unread,
Mar 3, 2014, 4:11:26 AM3/3/14
to pyt...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Bocheng,

>> my code is as followings:
>
>> global_data.load([10.8])
>> local_data=global_data.project("my_area",mode="nearset")
>> img=local_data.image(10.8,mode="L") img.add_overlay()
>> img.save("noaa_test.tif",floating_point=True)
>
>
>> The error message is: IndexError: 0-d arrays can only use a
>> single () or a list of newaxes (and a single ...) as an index
>
>> How to fix it?

Strange, I got a crash on the add_overlay call, with
ValueError: bad mode ?

Anyhow, from your error, I gather that img is empty or something ?

Best regards,
Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTFEc+AAoJEBdvyODiyJI446EH/1FWbiUOaWZr9RJ+NMAEyp/t
iwaF+Kh+8vhU75ot+l2KPTxI5pFyqZW+i9O7OcC6VumJyyJpYivdvBGiV8lxKY6P
u/JH8HHTLsiwh1p87VXwPE7iBjc5uNFgQ4zKQwGZASeBx+dymgoTmy/OpGUrI6PS
vhiAn/Eab4pCT1xMgJon6n6GGYg8NNkEP7CnSBrqpPzrwIkw6nD6u9f6iLr5TpPh
5br8TCrGU936oqs8+izt+Ez1qR1STzX13BuT6HCkI/HMUhBaz4ZDdZamIQQKQ9iJ
WFERxNou3huX/rwd7sTFcaDf3VuU+E6MIwlB4lkvnJcV3lFAwCTqKSxM9XEDkMI=
=hOBn
-----END PGP SIGNATURE-----
martin_raspaud.vcf

Panu Lahtinen

unread,
Mar 3, 2014, 4:13:45 AM3/3/14
to pyt...@googlegroups.com
On 03/03/2014 06:05 AM, 張伯誠 wrote:
> my code is as followings:
>
> global_data.load([10.8])
> local_data=global_data.project("my_area",mode="nearset")

There's a typo, should be "nearest".


Panu

--
Finnish Meteorological Institute
Erik Palménin aukio 1, P.O.Box 503, FIN-00101 Helsinki, Finland
Room: 2B10a, Phone: +358 50 380 3261

張伯誠

unread,
Mar 4, 2014, 10:49:25 PM3/4/14
to pyt...@googlegroups.com, martin....@smhi.se


Martin Raspaud於 2014年3月3日星期一UTC+8下午4時58分51秒寫道:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Bocheng,

>> Martin, I have tried this way last week, and tried it again
>> today, but my ncdump  can't read my netcdf files...
>
>> my ncdump -V is: ncdump,  HDF Version 4.2 Release 9, February 7,
>> 2013 the error message is: ncdump: ncopen failed on
>> noaa19_sample.nc
>
>> my code is :
>> global_data=PolarFactory.create_scene("noaa","19","avhrr",time_slot,orbit)
>>  # if use npp viirs , the result is still the same...
>> global_data.load([10.8])
>> local_data=global_data.project("my_area",mode="nearest")
>> local_data.save("noaa_sample.nc")
>
>> Can your ncdump read netcdf files?

Yes I have no problem reading the files with ncdump. My version is:
"netcdf library version 4.1.1 of Jan 30 2014 05:31:22 $" on our RHEL6.5

Another thing you can try is to open your file with h5dump, that
should work...
Otherwise, you could also send me you sample netcdf file, see if I can
read it.

By the way, I fixed a couple of bugs in mpop while testing the netcdf
saving, maybe this can make a difference ? Check out the pre-master
branch if you want to test it.

Hi, Martin,

I tried your new fix, but got a new error: TypeError: get_proj_coords() got an unexpected keyword argument 'cache'

According to this post:http://pyresample.googlecode.com/svn/trunk/docs/build/html/API.html#module-geometry

The get_proj_coords method doesn't need have arguments?


Bocheng
 

張伯誠

unread,
Mar 4, 2014, 10:55:12 PM3/4/14
to pyt...@googlegroups.com, panu.l...@fmi.fi
Hi, Panu,

Yes, that is a typo, but there is no such typo im my code.

The code here is copied by my hand from another computer which can't connect to outside network.

Bocheng

Panu Lahtinen於 2014年3月3日星期一UTC+8下午5時13分45秒寫道:

張伯誠

unread,
Mar 4, 2014, 11:01:34 PM3/4/14
to pyt...@googlegroups.com, martin....@smhi.se


Martin Raspaud於 2014年3月3日星期一UTC+8下午5時11分26秒寫道:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Bocheng,

>> my code is as followings:
>
>> global_data.load([10.8])
>> local_data=global_data.project("my_area",mode="nearset")
>> img=local_data.image(10.8,mode="L") img.add_overlay()
>> img.save("noaa_test.tif",floating_point=True)
>
>
>> The error message is: IndexError: 0-d arrays can only use a
>> single () or a list of newaxes (and a single ...) as an index
>
>> How to fix it?

Strange, I got a crash on the add_overlay call, with
ValueError: bad mode ?

Sorry, the mode= "nearset"  should be mode="nearest"...



Anyhow, from your error, I gather that img is empty or something ?

But if no add_overlay() it has no problem to run img.save( "noaa_test.tif",floating_point=True), and the  noaa_test.tif can be read by Tiff reader.

Bocheng

Martin Raspaud

unread,
Mar 5, 2014, 3:19:39 AM3/5/14
to 張伯誠, pyt...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Bocheng,


>> I tried your new fix, but got a new error: TypeError:
>> get_proj_coords() got an unexpected keyword argument 'cache'
>
>> According to this
>> post:http://pyresample.googlecode.com/svn/trunk/docs/build/html/API.html#module-geometry
>
>> The get_proj_coords method doesn't need have arguments?

Indeed, sorry about that... I am using pyresample's pre-master branch,
that's why the argument is there...

Best regards,
Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTFt4bAAoJEBdvyODiyJI4hhoIAMphVeTNa0aCxjLwW2kuovgl
ZLuEdyv4jSrneUMfi4G0ECnGUYvTEc8M6S8FL+JU9bVVV/2gqz6Su8K6p0Pnq8e0
Va1v4uG6SfXBtvVW/gUtdMT0dElTSCvJHggOHg/4tP+nsizSORYy/bAoeWp5U1CC
POGcS1JTB6Q30VeJVCi7y8QCHe4LLxR3iGr04WnZ3Du9/9y7C/BAFyP3lM53J5Uv
tYfKLZYSHvJMZ3Csd6UQxDnTfbpLSbD/Ba46DGriEqUxX1FUHL6miCzioy0wPI7g
a7hqEkGOMlpP5xXpaVusyqOxc7L5TcC42N03J2TWJJrXXk4NdjVK1aeJddCLry0=
=x11N
-----END PGP SIGNATURE-----
martin_raspaud.vcf

Martin Raspaud

unread,
Mar 5, 2014, 1:20:47 PM3/5/14
to pyt...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Bocheng,

>> But if no add_overlay() it has no problem to run img.save(
>> "noaa_test.tif",floating_point=True), and the noaa_test.tif can
>> be read by Tiff reader.

I will try to reproduce your error.

Best regards,
Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTF2r/AAoJEBdvyODiyJI49SQH/iEhfFOLkWzoqINKMzQsHonw
hGZblPzGDXxUJCSfnUVcol4t3EG5GjzpX/ztOR4hWd1u/zn+7Q+ANkCfb7ZK8GAA
iXzLPrZFz1+sYKE7sf8ly1Vlt/TVPUuzOcDXbNe2bDf2TeVGqGYM+AUToPt5KJjJ
xkAqXFvw07EFb6nZp/BWvQp6dPFLutmFQkoFBAmgigUZnBcSweziHwKLVnk4dswR
MfvdUs7F3tOvbX8YJbLkk96EmrEvvU9koLRUp/vyrhZ6YNy+AzUlB0l6jZHT7aCc
d8au+NcyYaLsNe+9VCJqkspIwRbKYhLxa1MSIxfLo5uUtgkoAR8Ba5T5p8gBJRs=
=9Mbc
-----END PGP SIGNATURE-----
martin_raspaud.vcf

張伯誠

unread,
Mar 6, 2014, 3:50:53 AM3/6/14
to pyt...@googlegroups.com, martin....@smhi.se


Martin Raspaud於 2014年3月3日星期一UTC+8下午4時58分51秒寫道:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Bocheng,

>> Martin, I have tried this way last week, and tried it again
>> today, but my ncdump  can't read my netcdf files...
>
>> my ncdump -V is: ncdump,  HDF Version 4.2 Release 9, February 7,
>> 2013 the error message is: ncdump: ncopen failed on
>> noaa19_sample.nc
>
>> my code is :
>> global_data=PolarFactory.create_scene("noaa","19","avhrr",time_slot,orbit)
>>  # if use npp viirs , the result is still the same...
>> global_data.load([10.8])
>> local_data=global_data.project("my_area",mode="nearest")
>> local_data.save("noaa_sample.nc")
>
>> Can your ncdump read netcdf files?

Yes I have no problem reading the files with ncdump. My version is:
"netcdf library version 4.1.1 of Jan 30 2014 05:31:22 $" on our RHEL6.5

Another thing you can try is to open your file with h5dump, that
should work...

Hello, Martin,

I have updated my pyresample from verison 0.8.0 to 1.1.0, so I can use your new fix.
Unfortunately, my ncdump cannot still read the nc files, however, h5dump can read the nc files.

What is the reason? My settings have some mistakes?

Thanks for your help.

Bocheng
 

Martin Raspaud

unread,
Mar 6, 2014, 4:19:15 AM3/6/14
to pyt...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/03/14 09:50, 張伯誠 wrote:
>> Hello, Martin,
>
>> I have updated my pyresample from verison 0.8.0 to 1.1.0, so I
>> can use your new fix. Unfortunately, my ncdump cannot still read
>> the nc files, however, h5dump can read the nc files.
>
>> What is the reason? My settings have some mistakes?

Hello Bocheng,

Ok, can you send me your nc file ? I will try to use my version of
ncdump on it, to see if it works better.
If it works with h5dump, then I'm not sure there's anything wrong with
the file...

Best regards,
Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTGD2SAAoJEBdvyODiyJI4R00H/AkGnIi6FkiioEJkMC04WtLe
Fr2x4udNEiD4Fi+2QPmY0OQ0+o+vXeSB4Mz7ZhUHzeUIoCrmqIvO7QMO5DQUYvZk
y2HebtC5q3dRLXx6hKxJPT95cm+zZqQKMrkSYXyZb9UYEpwtQBl0ey2wlt8OW0B+
Yx5CX/Lo3ckEVFNqG6RNRUTiUbDZpg7EVKzFBIBoyqMboRoY3zmc9kEcCnlBQ0Bl
W2oPQMaxG6ex0Du++YtbYPyX4/odPDcEGrPRv1EVo6wbgHwCJ1rksHmUz8uhs7at
af13nGYwSY6SzgwSO8Mr1oRXy0W/fUxTgCIJFnwjjGlP1bZP89XsRoRy6GDqKTY=
=HI0U
-----END PGP SIGNATURE-----
martin_raspaud.vcf

Martin Raspaud

unread,
Mar 6, 2014, 5:02:15 AM3/6/14
to pyt...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Bocheng,

Thanks for the file. It actually reads fine with my ncdump, see later...
My ncdump reports:
netcdf library version 4.1.1 of Jan 30 2014 05:31:22 $

Best regards,
Martin

$ ncdump ~/Downloads/noaa_sample.nc -h
netcdf noaa_sample {
dimensions:
y0 = 7162 ;
x0 = 7200 ;
band0 = 1 ;
nv = 2 ;
variables:
short Image0(y0, x0, band0) ;
Image0:_FillValue = -32768s ;
Image0:add_offset = 241.809305441928 ;
Image0:grid_mapping = "grid_mapping_0" ;
Image0:long_name = "Band data" ;
Image0:resolution = 1090L ;
Image0:scale_factor = 0.00290400962614538 ;
Image0:units = "K" ;
string band0(band0) ;
band0:standard_name = "band_name" ;
int64 grid_mapping_0 ;
grid_mapping_0:false_easting = 0L ;
grid_mapping_0:false_northing = 0L ;
grid_mapping_0:grid_mapping_name = "stereographic" ;
grid_mapping_0:latitude_of_projection_origin = 25. ;
grid_mapping_0:longitude_of_projection_origin = 121.5 ;
grid_mapping_0:scale_factor_at_projection_origin = 1. ;
grid_mapping_0:units = "m" ;
double nominal_wavelength0(band0) ;
nominal_wavelength0:bounds = "wl_bnds0" ;
nominal_wavelength0:standard_name = "radiation_wavelength" ;
nominal_wavelength0:units = "um" ;
double time ;
time:long_name = "Nominal time of the image" ;
time:standard_name = "time" ;
time:units = "seconds since 1970-01-01 00:00:00" ;
double wl_bnds0(band0, nv) ;
double x0(x0) ;
x0:long_name = "x coordinate of projection" ;
x0:standard_name = "projection_x_coordinate" ;
x0:units = "rad" ;
double y0(y0) ;
y0:long_name = "y coordinate of projection" ;
y0:standard_name = "projection_y_coordinate" ;
y0:units = "rad" ;

// global attributes:
:Conventions = "CF-1.5" ;
:history = "2014-03-06T08:08:05.529115 - Saved as netcdf4/cf by
pytroll/mpop." ;
:instrument = "avhrr" ;
:orbit = "25836" ;
:platform = "noaa-19" ;
}


On 06/03/14 10:19, Martin Raspaud wrote:
> On 06/03/14 09:50, 張伯誠 wrote:
>>> Hello, Martin,
>
>>> I have updated my pyresample from verison 0.8.0 to 1.1.0, so I
>>> can use your new fix. Unfortunately, my ncdump cannot still
>>> read the nc files, however, h5dump can read the nc files.
>
>>> What is the reason? My settings have some mistakes?
>
> Hello Bocheng,
>
> Ok, can you send me your nc file ? I will try to use my version of
> ncdump on it, to see if it works better. If it works with h5dump,
> then I'm not sure there's anything wrong with the file...
>
> Best regards, Martin
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTGEenAAoJEBdvyODiyJI4UqYH/3ywBheeruwk/hqYLhS/Err0
t7vA1Kuh8EWXFw2bTAJHFjDTbn05GDfoEVhIHXf1p9Y9c5gN6OXy85mX2yxdgOJ2
eQYv5ZVZo6U1QWReSkwfI96BLzD9PWIlHLWYEhj6UE797vOiexfQGfut09k9hrjP
g4QzaZFbrCpX4rjJ65ebmCxZ0AYFUxlPF7kX1JR8ZxPd+wwRItDCOAiGR2sXR/E9
YVIT9kYMvxLtgtmiYPCqJm4AluuTPhWfY5i579p60nrbUNsqzcBzLAtfPqNQBDR9
u8JCwDExWA3TpULw5UGghNTIMlsG8a9JnQHvhjpg6sM0gQylxaXbmL2s7QQFx4Q=
=HxOh
-----END PGP SIGNATURE-----
martin_raspaud.vcf

張伯誠

unread,
Mar 6, 2014, 8:00:56 PM3/6/14
to pyt...@googlegroups.com, martin....@smhi.se


Martin Raspaud於 2014年3月6日星期四UTC+8下午6時02分15秒寫道:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Bocheng,

Thanks for the file. It actually reads fine with my ncdump, see later...
My ncdump reports:
netcdf library version 4.1.1 of Jan 30 2014 05:31:22 $

Best regards,
Martin


Hi, Martin,

I see it.

So, that is my ncdump can't read....

Thanks for your test!

Bocheng
 
Reply all
Reply to author
Forward
0 new messages