
import sys
import os

sys.path.append('./climatemaps')

import climatemaps


DATA_DIR = './website/data'


def test():
    for month in range(1, 13):
        latrange, lonrange, Z = climatemaps.data.import_climate_data(month)
        filepath_out = os.path.join(DATA_DIR, 'contour_cloud_' + str(month) + '.json')
        test_config = climatemaps.contour.ContourPlotConfig()
        contourmap = climatemaps.contour.Contour(test_config, lonrange, latrange, Z)
        contourmap.create_contour_data(filepath_out)


if __name__ == "__main__":
    test()


import sys
import os

sys.path.append('./climatemaps')

import climatemaps


DATA_OUT_DIR = './website/data'

TYPES = {
    'precipitation': './data/precipitation/cpre6190.dat',
    'cloud': './data/cloud/ccld6190.dat',
}


def main():
    for data_type, filepath in TYPES.items():
        for month in range(1, 13):
            latrange, lonrange, Z = climatemaps.data.import_climate_data(filepath, month)
            filepath_out = os.path.join(DATA_OUT_DIR, 'contour_' + data_type +'_' + str(month) + '.json')
            test_config = climatemaps.contour.ContourPlotConfig()
            contourmap = climatemaps.contour.Contour(test_config, lonrange, latrange, Z)
            contourmap.create_contour_data(filepath_out)


if __name__ == "__main__":
    main()

Create contour data for multiple climate data types
Create contour data for multiple climate data types

  
  import sys
  import os
  
  sys.path.append('./climatemaps')
  
  import climatemaps
  
  
- DATA_DIR = './website/data'
+ DATA_OUT_DIR = './website/data'
+ 
+ TYPES = {
+     'precipitation': './data/precipitation/cpre6190.dat',
+     'cloud': './data/cloud/ccld6190.dat',
+ }
  
  
- def test():
+ def main():
+     for data_type, filepath in TYPES.items():
-     for month in range(1, 13):
+         for month in range(1, 13):
-         latrange, lonrange, Z = climatemaps.data.import_climate_data(month)
+             latrange, lonrange, Z = climatemaps.data.import_climate_data(filepath, month)
-         filepath_out = os.path.join(DATA_DIR, 'contour_cloud_' + str(month) + '.json')
+             filepath_out = os.path.join(DATA_OUT_DIR, 'contour_' + data_type +'_' + str(month) + '.json')
-         test_config = climatemaps.contour.ContourPlotConfig()
+             test_config = climatemaps.contour.ContourPlotConfig()
-         contourmap = climatemaps.contour.Contour(test_config, lonrange, latrange, Z)
+             contourmap = climatemaps.contour.Contour(test_config, lonrange, latrange, Z)
-         contourmap.create_contour_data(filepath_out)
+             contourmap.create_contour_data(filepath_out)
  
  
  if __name__ == "__main__":
-     test()
+     main()
  
Create contour data for multiple climate data types
## Code Before:

import sys
import os

sys.path.append('./climatemaps')

import climatemaps


DATA_DIR = './website/data'


def test():
    for month in range(1, 13):
        latrange, lonrange, Z = climatemaps.data.import_climate_data(month)
        filepath_out = os.path.join(DATA_DIR, 'contour_cloud_' + str(month) + '.json')
        test_config = climatemaps.contour.ContourPlotConfig()
        contourmap = climatemaps.contour.Contour(test_config, lonrange, latrange, Z)
        contourmap.create_contour_data(filepath_out)


if __name__ == "__main__":
    test()

## Instruction:
Create contour data for multiple climate data types
## Code After:

import sys
import os

sys.path.append('./climatemaps')

import climatemaps


DATA_OUT_DIR = './website/data'

TYPES = {
    'precipitation': './data/precipitation/cpre6190.dat',
    'cloud': './data/cloud/ccld6190.dat',
}


def main():
    for data_type, filepath in TYPES.items():
        for month in range(1, 13):
            latrange, lonrange, Z = climatemaps.data.import_climate_data(filepath, month)
            filepath_out = os.path.join(DATA_OUT_DIR, 'contour_' + data_type +'_' + str(month) + '.json')
            test_config = climatemaps.contour.ContourPlotConfig()
            contourmap = climatemaps.contour.Contour(test_config, lonrange, latrange, Z)
            contourmap.create_contour_data(filepath_out)


if __name__ == "__main__":
    main()
