File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1698,7 +1698,7 @@ def to_mos(self, file_path):
16981698 return file_path
16991699
17001700 def _get_wea_header (self ):
1701- return "place %s\n " % self .location .city + \
1701+ return "place %s_% s\n " % ( self .location .city , self . location . country ) + \
17021702 "latitude %.2f\n " % self .location .latitude + \
17031703 "longitude %.2f\n " % - self .location .longitude + \
17041704 "time_zone %d\n " % (- self .location .time_zone * 15 ) + \
Original file line number Diff line number Diff line change @@ -607,7 +607,7 @@ def is_annual(self):
607607 @property
608608 def header (self ):
609609 """Get the Wea header as a string."""
610- return "place %s\n " % self .location .city + \
610+ return "place %s_% s\n " % ( self .location .city , self . location . country ) + \
611611 "latitude %.2f\n " % self .location .latitude + \
612612 "longitude %.2f\n " % - self .location .longitude + \
613613 "time_zone %d\n " % (- self .location .time_zone * 15 ) + \
@@ -1125,7 +1125,14 @@ def _parse_wea_header(weaf, wea_file_name):
11251125 assert first_line .startswith ('place' ), 'Failed to find place in .wea header.\n ' \
11261126 '{} is not a valid wea file.' .format (wea_file_name )
11271127 location = Location ()
1128- location .city = ' ' .join (first_line .split ()[1 :])
1128+ place_info = ' ' .join (first_line .split ()[1 :])
1129+ if '_' in place_info :
1130+ city , country = place_info .rsplit ('_' , 1 )
1131+ else :
1132+ city = place_info
1133+ country = '-'
1134+ location .city = city
1135+ location .country = country
11291136 location .latitude = float (weaf .readline ().split ()[- 1 ])
11301137 location .longitude = - float (weaf .readline ().split ()[- 1 ])
11311138 location .time_zone = - int (weaf .readline ().split ()[- 1 ]) / 15
You can’t perform that action at this time.
0 commit comments