Skip to content

Commit

Permalink
make use of sat_nr function in nwcsaf_msg.py
Browse files Browse the repository at this point in the history
  • Loading branch information
uhamann committed Jul 25, 2016
1 parent 512f4a1 commit 8a6840f
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions mpop/satin/nwcsaf_msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2942,7 +2942,7 @@ def load(scene, **kwargs):
ct_chan = MsgCloudMask()
ct_chan.read(filename,calibrate)
ct_chan.satid = (scene.satname.capitalize() +
str(int(scene.number)).rjust(2))
str(scene.sat_nr()).rjust(2))
ct_chan.resolution = ct_chan.area.pixel_size_x
scene.channels.append(ct_chan)

Expand All @@ -2961,7 +2961,7 @@ def load(scene, **kwargs):
LOG.debug("Uncorrected file: %s", filename)
ct_chan.name = "CloudType"
ct_chan.satid = (scene.satname.capitalize() +
str(int(scene.number)).rjust(2))
str(scene.sat_nr()).rjust(2))
ct_chan.resolution = ct_chan.area.pixel_size_x
scene.channels.append(ct_chan)

Expand All @@ -2981,10 +2981,12 @@ def load(scene, **kwargs):
ct_chan_plax.read(filename)
ct_chan_plax.name = "CloudType_plax"
ct_chan_plax.satid = (scene.satname.capitalize() +
str(int(scene.number)).rjust(2))
str(scene.sat_nr()).rjust(2))
ct_chan_plax.resolution = ct_chan_plax.area.pixel_size_x
scene.channels.append(ct_chan_plax)

print "*** hallo world***"

if "CTTH" in scene.channels_to_load:
filename_wildcards = (scene.time_slot.strftime(pathname)
% {"number": "03",
Expand All @@ -2993,8 +2995,10 @@ def load(scene, **kwargs):
if filename != None:
ct_chan = MsgCTTH()
ct_chan.read(filename,calibrate)
ct_chan.satid = (scene.satname.capitalize() +
str(int(scene.number)).rjust(2))
print "CCC", scene.sat_nr()
ct_chan.satid = (scene.satname[0:8].capitalize() +
str(scene.sat_nr()).rjust(2))
print "bullshit (nwcsat_msg.py) ", ct_chan.satid # "Meteosat 9"
ct_chan.resolution = ct_chan.area.pixel_size_x
scene.channels.append(ct_chan)

Expand All @@ -3008,7 +3012,7 @@ def load(scene, **kwargs):
ct_chan.read(filename,calibrate)
ct_chan.name = "CRR_" # !!!!! changed as we create another channel named 'CRR' when transforming the format
ct_chan.satid = (scene.satname.capitalize() +
str(int(scene.number)).rjust(2))
str(scene.sat_nr()).rjust(2))
ct_chan.resolution = ct_chan.area.pixel_size_x
scene.channels.append(ct_chan)

Expand All @@ -3022,7 +3026,7 @@ def load(scene, **kwargs):
ct_chan.read(filename,calibrate)
ct_chan.name = "PC"
ct_chan.satid = (scene.satname.capitalize() +
str(int(scene.number)).rjust(2))
str(scene.sat_nr()).rjust(2))
ct_chan.resolution = ct_chan.area.pixel_size_x
scene.channels.append(ct_chan)

Expand All @@ -3036,7 +3040,7 @@ def load(scene, **kwargs):
ct_chan.read(filename,calibrate)
ct_chan.name = "SPhR"
ct_chan.satid = (scene.satname.capitalize() +
str(int(scene.number)).rjust(2))
str(scene.sat_nr()).rjust(2))
ct_chan.resolution = ct_chan.area.pixel_size_x
scene.channels.append(ct_chan)

Expand All @@ -3050,7 +3054,7 @@ def load(scene, **kwargs):
ct_chan.read(filename,calibrate)
ct_chan.name = "PCPh_"
ct_chan.satid = (scene.satname.capitalize() +
str(int(scene.number)).rjust(2))
str(scene.sat_nr()).rjust(2))
ct_chan.resolution = ct_chan.area.pixel_size_x
scene.channels.append(ct_chan)

Expand All @@ -3064,16 +3068,19 @@ def load(scene, **kwargs):
ct_chan.read(filename,calibrate)
ct_chan.name = "CRPh_"
ct_chan.satid = (scene.satname.capitalize() +
str(int(scene.number)).rjust(2))
str(scene.sat_nr()).rjust(2))
ct_chan.resolution = ct_chan.area.pixel_size_x
scene.channels.append(ct_chan)

if 'filename' in locals() and filename != None:
# print "nwcsaf_msg", len(filename), filename
if len(filename) > 12:
sat_nr= int(basename(filename)[10:11])+7
if scene.number != str(sat_nr).zfill(2):
print "*** Warning, change Meteosat number to "+str(sat_nr).zfill(2)+" (input: "+scene.number+")"
scene.number = str(sat_nr).zfill(2)
if int(scene.sat_nr()) != int(sat_nr):
print "*** Warning, change Meteosat number to "+str(sat_nr)+" (input: "+scene.sat_nr()+")"
#scene.number = str(sat_nr).zfill(2)
# !!! update number !!!
scene.number = str(sat_nr)


LOG.info("Loading channels done.")

0 comments on commit 8a6840f

Please sign in to comment.