|
1 | 1 | # BUILD FLAG: Set to True when creating executable packages to ensure dependency work-arounds |
2 | 2 | # Set to False for code releases to ensure Linux installation is easier to achieve |
3 | | -EXECUTABLE_BUILD_INCLUSION = False |
| 3 | +EXECUTABLE_BUILD_INCLUSION = True |
4 | 4 |
|
5 | 5 | # Python modules |
6 | 6 | import re |
@@ -241,7 +241,7 @@ def checkClimateDataUrl(self) : |
241 | 241 | #print 'check 2' |
242 | 242 | return False |
243 | 243 | except Exception, e : |
244 | | - current_url_file = url.urlopen('http://homepage.cs.latrobe.edu.au/shaythorne/paleoview/current_url.txt') |
| 244 | + current_url_file = url.urlopen('https://storage.googleapis.com/paleoview-data/current_url.txt') |
245 | 245 | self.setClimateDataUrl(current_url_file.readline().rstrip()) |
246 | 246 | try : |
247 | 247 | current_first_url_file = url.urlopen((self.climate_data_url + 'current_url.txt')) |
@@ -1169,17 +1169,37 @@ def generateNetCdfClimateData(self, parameter, from_year_ad, until_year_ad, min_ |
1169 | 1169 | window = rootgrp.createVariable('window','i4',('single',)) |
1170 | 1170 | width = rootgrp.createVariable('width','i4',('single',)) |
1171 | 1171 | decimals = rootgrp.createVariable('decimals','i4',('single',)) |
1172 | | - months = rootgrp.createVariable('months','i4',('month',), zlib=zlib) |
1173 | | - latitudes = rootgrp.createVariable('latitudes','f8',('lat',), zlib=zlib) |
1174 | | - longitudes = rootgrp.createVariable('longitudes','f8',('lon',), zlib=zlib) |
1175 | | - latitudes.units = 'degrees north' |
1176 | | - longitudes.units = 'degrees east' |
| 1172 | +## months = rootgrp.createVariable('months','i4',('month',), zlib=zlib) |
| 1173 | +## latitudes = rootgrp.createVariable('latitudes','f8',('lat',), zlib=zlib) |
| 1174 | +## longitudes = rootgrp.createVariable('longitudes','f8',('lon',), zlib=zlib) |
| 1175 | +## latitudes.units = 'degrees north' |
| 1176 | +## longitudes.units = 'degrees east' |
1177 | 1177 | window[:] = np.array(self.download_data_window) |
1178 | 1178 | width[:] = np.array(data_width) |
1179 | 1179 | decimals[:] = np.array(data_decimals) |
1180 | | - months[:] = np.array(range(12)) + 1 |
1181 | | - latitudes[:] = np.arange(88.75,-88.751,-2.5) |
1182 | | - longitudes[:] = np.arange(-178.75,178.751,2.5) |
| 1180 | +## months[:] = np.array(range(12)) + 1 |
| 1181 | +## latitudes[:] = np.arange(88.75,-88.751,-2.5) |
| 1182 | +## longitudes[:] = np.arange(-178.75,178.751,2.5) |
| 1183 | + |
| 1184 | + # Create coordinate variables NEW |
| 1185 | + month = rootgrp.createVariable('month','i4',('month',), zlib=zlib) |
| 1186 | + month.units = 'month' |
| 1187 | + month.axis = 'T' |
| 1188 | + month.long_name = 'month' |
| 1189 | + month.standard_name = 'month' |
| 1190 | + month[:] = np.array(range(12)) + 1 |
| 1191 | + latitude = rootgrp.createVariable('lat','f8',('lat',), zlib=zlib) |
| 1192 | + latitude.units = 'degrees_north' |
| 1193 | + latitude.axis = 'Y' |
| 1194 | + latitude.long_name = 'latitude' |
| 1195 | + latitude.standard_name = 'latitude' |
| 1196 | + latitude[:] = np.arange(88.75,-88.751,-2.5) |
| 1197 | + longitude = rootgrp.createVariable('lon','f8',('lon',), zlib=zlib) |
| 1198 | + longitude.units = 'degrees_east' |
| 1199 | + longitude.axis = 'X' |
| 1200 | + longitude.long_name = 'longitude' |
| 1201 | + longitude.standard_name = 'longitude' |
| 1202 | + longitude[:] = np.arange(-178.75,178.751,2.5) |
1183 | 1203 |
|
1184 | 1204 | # Add overlap to allow for interval window |
1185 | 1205 | from_year_ad = max((from_year_ad - self.download_data_window), min_year_ad) |
@@ -1223,6 +1243,7 @@ def generateNetCdfClimateData(self, parameter, from_year_ad, until_year_ad, min_ |
1223 | 1243 |
|
1224 | 1244 | # Load grid data into subgroup variable using year label |
1225 | 1245 | data = subgroup.createVariable(year_str,'f8',('month','lat','lon',), zlib=zlib, least_significant_digit=(data_decimals+1)) # one more decimal than formatted |
| 1246 | + data.coordinates = 'month lat lon' # NEW |
1226 | 1247 | data.units = self.parameter_unit_string[parameter] |
1227 | 1248 | data.long_name = parameter.replace('_',' ').title() |
1228 | 1249 | data.standard_name = parameter |
@@ -1259,8 +1280,8 @@ def downloadClimateData(self, parameter, from_year_ad, until_year_ad, delimiter= |
1259 | 1280 | # Download NetCDF file |
1260 | 1281 | local_netCdf_path = path.join(self.climate_data_directory['path'], netCdf_file) |
1261 | 1282 | try : |
1262 | | - check_connection = url.urlopen((self.climate_data_url + netCdf_file)) |
1263 | | - check_connection.close() |
| 1283 | + #check_connection = url.urlopen((self.climate_data_url + netCdf_file)) |
| 1284 | + #check_connection.close() |
1264 | 1285 | urllib.urlretrieve((self.climate_data_url + netCdf_file), local_netCdf_path, reporthook=self.netCdfDownloadProgress) |
1265 | 1286 | except Exception, e : |
1266 | 1287 | exception_message = 'Could not open ' + netCdf_file + '\nExpected climate data NetCDF file at: \n' + self.climate_data_url + '\n' + str(e) |
|
0 commit comments