Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • rotare/rotor-db
1 result
Show changes
Commits on Source (2)
database/UIUC-propDB*
# Landgrebe, An Analytical and Experimental Investigation of Helicopter Rotor Hover Performance and Wake Geometry Characteristics. 1971. (USAAMRDL-TR-71-24)
# Tags: hover
# -, -, fps, -, -, deg, -, -, -, -, rc/R, -
number of blades, solidity, tip speed, tip reynolds, tip mach, collective pitch, CT, CP, CT/sigma, CP/sigma, root cutout, notes
2, 0.03498, 700.0, 548274, 0.62699, 0.0 -0.000052, 0.0000619 -0.00150, 0.001770, 0.148,
2, 0.03498, 700.0, 548274, 0.62699, 6.0, 0.001837, 0.0001361, 0.05250, 0.003890, 0.148,
2, 0.03498, 700.0, 548274, 0.62699, 6.0, 0.001924, 0.0001350, 0.05500, 0.003860, 0.148,
2, 0.03498, 700.0, 548274, 0.62699, 7.0, 0.002218, 0.0001634, 0.06340, 0.004670, 0.148,
2, 0.03498, 700.0, 548274, 0.62699, 7.0, 0.002288, 0.0001616, 0.06540, 0.004620, 0.148,
2, 0.03498, 700.0, 548274, 0.62699, 8.0, 0.002785, 0.0002089, 0.07960, 0.005970, 0.148,
2, 0.03498, 700.0, 548274, 0.62699, 9.0, 0.003082, 0.0002400, 0.08810, 0.006860, 0.148,
2, 0.03498, 700.0, 548274, 0.62699, 10.0, 0.003233, 0.0002760, 0.09240, 0.007890, 0.148, STALL
2, 0.03498, 700.0, 548274, 0.62699, 10.0, 0.003397, 0.0002813, 0.09710, 0.008040, 0.148, STALL
2, 0.03498, 700.0, 548274, 0.62699, 10.0, 0.003435, 0.0002911, 0.09820, 0.008320, 0.148, STALL
2, 0.03498, 700.0, 548274, 0.62699, 10.0, 0.003463, 0.0003051, 0.09900, 0.008720, 0.148, STALL
2, 0.03498, 700.0, 548274, 0.62699, 10.5, 0.003540, 0.0003086, 0.10120, 0.008820, 0.148, STALL
4, 0.06997, 700.0, 548274, 0.62699, 0.0 -0.000014, 0.0001203 -0.00020, 0.001720, 0.148,
4, 0.06997, 700.0, 548274, 0.62699, 6.0, 0.002645, 0.0002477, 0.03780, 0.003540, 0.148,
4, 0.06997, 700.0, 548274, 0.62699, 6.0, 0.002680, 0.0002512, 0.03830, 0.003590, 0.148,
4, 0.06997, 700.0, 548274, 0.62699, 6.0, 0.002764, 0.0002456, 0.03950, 0.003510, 0.148,
4, 0.06997, 700.0, 548274, 0.62699, 6.0, 0.003047, 0.0002704, 0.04355, 0.003865, 0.148,
4, 0.06997, 700.0, 548274, 0.62699, 8.0, 0.004275, 0.0003869, 0.06110, 0.005530, 0.148,
4, 0.06997, 700.0, 548274, 0.62699, 8.0, 0.004268, 0.0003855, 0.06100, 0.005510, 0.148,
4, 0.06997, 700.0, 548274, 0.62699, 10.0, 0.005681, 0.0005786, 0.08120, 0.008270, 0.148,
4, 0.06997, 700.0, 548274, 0.62699, 10.0, 0.005660, 0.0005786, 0.08090, 0.008270, 0.148, STALL
4, 0.06997, 700.0, 548274, 0.62699, 10.5, 0.005772, 0.0006353, 0.08250, 0.009080, 0.148, STALL
4, 0.06997, 700.0, 548274, 0.62699, 11.0, 0.006129, 0.0007242, 0.08760, 0.010350, 0.148, STALL
4, 0.06997, 700.0, 548274, 0.62699, 11.0, 0.006178, 0.0007606, 0.08830, 0.010870, 0.148, STALL
4, 0.06997, 700.0, 548274, 0.62699, 11.0, 0.006003, 0.0007060, 0.08580, 0.010090, 0.148, STALL
6, 0.10495, 700.0, 548274, 0.62699, 0.0, 0.000000, 0.0001816, 0.00000, 0.001730, 0.148,
6, 0.10495, 700.0, 548274, 0.62699, 6.0, 0.003338, 0.0003484, 0.03180, 0.003320, 0.148,
6, 0.10495, 700.0, 548274, 0.62699, 6.0, 0.003463, 0.0003946, 0.03300, 0.003760, 0.148,
6, 0.10495, 700.0, 548274, 0.62699, 8.0, 0.005185, 0.0005300, 0.04940, 0.005050, 0.148,
6, 0.10495, 700.0, 548274, 0.62699, 8.0, 0.005216, 0.0005279, 0.04970, 0.005030, 0.148,
6, 0.10495, 700.0, 548274, 0.62699, 10.0, 0.007137, 0.0007934, 0.06800, 0.007560, 0.148,
6, 0.10495, 700.0, 548274, 0.62699, 10.0, 0.007263, 0.0008018, 0.06920, 0.007640, 0.148,
6, 0.10495, 700.0, 548274, 0.62699, 10.0, 0.007273, 0.0007997, 0.06930, 0.007620, 0.148,
6, 0.10495, 700.0, 548274, 0.62699, 11.0, 0.007934, 0.0010149, 0.07560, 0.009670, 0.148, STALL
6, 0.10495, 700.0, 548274, 0.62699, 11.0, 0.007955, 0.0010128, 0.07580, 0.009650, 0.148, STALL
8, 0.13994, 700.0, 548274, 0.62699, 0.0 -0.000028, 0.0002421 -0.00020, 0.001730, 0.148,
8, 0.13994, 700.0, 548274, 0.62699, 6.0, 0.003932, 0.0004534, 0.02810, 0.003240, 0.148,
8, 0.13994, 700.0, 548274, 0.62699, 6.0, 0.003946, 0.0004520, 0.02820, 0.003230, 0.148,
8, 0.13994, 700.0, 548274, 0.62699, 8.0, 0.006045, 0.0006745, 0.04320, 0.004820, 0.148,
8, 0.13994, 700.0, 548274, 0.62699, 8.0, 0.006059, 0.0006717, 0.04330, 0.004800, 0.148,
8, 0.13994, 700.0, 548274, 0.62699, 10.0, 0.008452, 0.0010089, 0.06040, 0.007210, 0.148,
8, 0.13994, 700.0, 548274, 0.62699, 10.0, 0.008564, 0.0010285, 0.06120, 0.007350, 0.148,
8, 0.13994, 700.0, 548274, 0.62699, 11.0, 0.009628, 0.0012692, 0.06880, 0.009070, 0.148,
8, 0.13994, 700.0, 548274, 0.62699, 11.0, 0.009670, 0.0012720, 0.06910, 0.009090, 0.148,
2, 0.03498, 600.0, 469949, 0.53742, 0.0 -0.000038, 0.0000554 -0.00109, 0.001584, 0.148, Average
2, 0.03498, 600.0, 469949, 0.53742, 6.0, 0.001846, 0.0001240, 0.05276, 0.003544, 0.148,
2, 0.03498, 600.0, 469949, 0.53742, 7.0, 0.002211, 0.0001498, 0.06319, 0.004283, 0.148,
2, 0.03498, 600.0, 469949, 0.53742, 7.0, 0.002174, 0.0001503, 0.06215, 0.004296, 0.148,
2, 0.03498, 600.0, 469949, 0.53742, 8.0, 0.002661, 0.0001844, 0.07605, 0.005272, 0.148,
2, 0.03498, 600.0, 469949, 0.53742, 8.0, 0.002671, 0.0001880, 0.07636, 0.005373, 0.148,
2, 0.03498, 600.0, 469949, 0.53742, 8.0, 0.002643, 0.0001883, 0.07555, 0.005381, 0.148,
2, 0.03498, 600.0, 469949, 0.53742, 9.0, 0.002986, 0.0002145, 0.08536, 0.006133, 0.148,
2, 0.03498, 600.0, 469949, 0.53742, 10.0, 0.003326, 0.0002503, 0.09507, 0.007154, 0.148, STALL
2, 0.03498, 600.0, 469949, 0.53742, 10.0, 0.003377, 0.0002617, 0.09654, 0.007481, 0.148, STALL
2, 0.03498, 600.0, 469949, 0.53742, 10.0, 0.003400, 0.0002675, 0.09720, 0.007646, 0.148, STALL
2, 0.03498, 600.0, 469949, 0.53742, 10.0, 0.003439, 0.0002656, 0.09831, 0.007593, 0.148, STALL
2, 0.03498, 600.0, 469949, 0.53742, 10.0, 0.003411, 0.0002614, 0.09750, 0.007472, 0.148, STALL
2, 0.03498, 600.0, 469949, 0.53742, 10.0, 0.003546, 0.0002746, 0.10137, 0.007850, 0.148, STALL
2, 0.03498, 600.0, 469949, 0.53742, 11.0, 0.003911, 0.0003204, 0.11181, 0.009158, 0.148, STALL
2, 0.03498, 600.0, 469949, 0.53742, 11.0, 0.003897, 0.0003265, 0.11139, 0.009332, 0.148, STALL
4, 0.06997, 600.0, 469949, 0.53742, 0.0 -0.000089, 0.0001109 -0.00127, 0.001586, 0.148, Average
4, 0.06997, 600.0, 469949, 0.53742, 6.0, 0.002655, 0.0002307, 0.03794, 0.003297, 0.148,
4, 0.06997, 600.0, 469949, 0.53742, 6.0, 0.002939, 0.0002535, 0.04200, 0.003623, 0.148,
4, 0.06997, 600.0, 469949, 0.53742, 8.0, 0.004096, 0.0003548, 0.05854, 0.005070, 0.148,
4, 0.06997, 600.0, 469949, 0.53742, 10.0, 0.005610, 0.0005160, 0.08018, 0.007375, 0.148,
4, 0.06997, 600.0, 469949, 0.53742, 10.5, 0.005859, 0.0005526, 0.08374, 0.007899, 0.148,
4, 0.06997, 600.0, 469949, 0.53742, 11.0, 0.006208, 0.0006039, 0.08873, 0.008631, 0.148,
4, 0.06997, 600.0, 469949, 0.53742, 11.0, 0.006341, 0.0006219, 0.09062, 0.008889, 0.148,
6, 0.10495, 600.0, 469949, 0.53742, 0.0 -0.000140, 0.0001668 - 0.00133, 0.001589, 0.148, Average
6, 0.10495, 600.0, 469949, 0.53742, 6.0, 0.003302, 0.0003403, 0.03146, 0.003242, 0.148,
6, 0.10495, 600.0, 469949, 0.53742, 8.0, 0.004993, 0.0004947, 0.04757, 0.004714, 0.148,
6, 0.10495, 600.0, 469949, 0.53742, 10.0, 0.007054, 0.0007265, 0.06721, 0.006923, 0.148,
6, 0.10495, 600.0, 469949, 0.53742, 10.5, 0.007197, 0.0007883, 0.06857, 0.007511, 0.148,
6, 0.10495, 600.0, 469949, 0.53742, 11.0, 0.008033, 0.0008854, 0.07654, 0.008436, 0.148,
6, 0.10495, 600.0, 469949, 0.53742, 11.0, 0.008154, 0.0008981, 0.07770, 0.008557, 0.148,
8, 0.13994, 600.0, 469949, 0.53742, 0.0 -0.000193, 0.0002233 -0.00138, 0.001596, 0.148,
8, 0.13994, 600.0, 469949, 0.53742, 6.0, 0.003895, 0.0004250, 0.02783, 0.003037, 0.148,
8, 0.13994, 600.0, 469949, 0.53742, 6.0, 0.003733, 0.0004375, 0.02668, 0.003126, 0.148,
8, 0.13994, 600.0, 469949, 0.53742, 8.0, 0.005836, 0.0006232, 0.04171, 0.004453, 0.148,
8, 0.13994, 600.0, 469949, 0.53742, 8.0, 0.005869, 0.0006350, 0.04194, 0.004538, 0.148,
8, 0.13994, 600.0, 469949, 0.53742, 10.0, 0.008179, 0.0009171, 0.05845, 0.006554, 0.148,
8, 0.13994, 600.0, 469949, 0.53742, 10.0, 0.008309, 0.0009340, 0.05938, 0.006674, 0.148,
8, 0.13994, 600.0, 469949, 0.53742, 11.0, 0.009587, 0.0011244, 0.06851, 0.008035, 0.148,
8, 0.13994, 600.0, 469949, 0.53742, 11.0, 0.009554, 0.0011396, 0.06828, 0.008144, 0.148,
2, 0.03498, 525.0, 411205, 0.47024, 0.0 -0.000003, 0.0000551 -0.00007, 0.001576, 0.148,
2, 0.03498, 525.0, 411205, 0.47024, 6.0, 0.001774, 0.0001199, 0.05071, 0.003427, 0.148,
2, 0.03498, 525.0, 411205, 0.47024, 7.0, 0.002207, 0.0001419, 0.06308, 0.004055, 0.148,
2, 0.03498, 525.0, 411205, 0.47024, 7.0, 0.002173, 0.0001454, 0.06211, 0.004155, 0.148,
2, 0.03498, 525.0, 411205, 0.47024, 8.0, 0.002611, 0.0001743, 0.07463, 0.004983, 0.148,
2, 0.03498, 525.0, 411205, 0.47024, 8.0, 0.002651, 0.0001772, 0.07577, 0.005064, 0.148,
2, 0.03498, 525.0, 411205, 0.47024, 9.0, 0.002909, 0.0002009, 0.08315, 0.005742, 0.148,
2, 0.03498, 525.0, 411205, 0.47024, 9.5, 0.003310, 0.0002319, 0.09463, 0.006630, 0.148,
2, 0.03498, 525.0, 411205, 0.47024, 10.0, 0.003363, 0.0002540, 0.09613, 0.007261, 0.148,
2, 0.03498, 525.0, 411205, 0.47024, 10.0, 0.003410, 0.0002498, 0.09748, 0.007141, 0.148,
2, 0.03498, 525.0, 411205, 0.47024, 10.0, 0.003470, 0.0002569, 0.09920, 0.007342, 0.148,
2, 0.03498, 525.0, 411205, 0.47024, 11.0, 0.003889, 0.0002940, 0.11117, 0.008403, 0.148,
2, 0.03498, 525.0, 411205, 0.47024, 11.0, 0.003889, 0.0002989, 0.11116, 0.008544, 0.148,
4, 0.06997, 525.0, 411205, 0.47024, 0.0, 0.000000, 0.0001109, 0.00000, 0.001584, 0.148,
4, 0.06997, 525.0, 411205, 0.47024, 6.0, 0.002536, 0.0002258, 0.03624, 0.003227, 0.148,
4, 0.06997, 525.0, 411205, 0.47024, 6.0, 0.002635, 0.0002315, 0.03766, 0.003308, 0.148,
4, 0.06997, 525.0, 411205, 0.47024, 6.0, 0.002898, 0.0002465, 0.04141, 0.003523, 0.148,
4, 0.06997, 525.0, 411205, 0.47024, 8.0, 0.003959, 0.0003424, 0.05659, 0.004894, 0.148,
4, 0.06997, 525.0, 411205, 0.47024, 8.0, 0.004075, 0.0003439, 0.05824, 0.004915, 0.148,
4, 0.06997, 525.0, 411205, 0.47024, 10.0, 0.005558, 0.0004976, 0.07944, 0.007112, 0.148,
4, 0.06997, 525.0, 411205, 0.47024, 10.5, 0.005834, 0.0005281, 0.08338, 0.007547, 0.148,
4, 0.06997, 525.0, 411205, 0.47024, 11.0, 0.006173, 0.0005745, 0.08822, 0.008211, 0.148,
4, 0.06997, 525.0, 411205, 0.47024, 11.0, 0.006306, 0.0005872, 0.09013, 0.008393, 0.148,
4, 0.06997, 525.0, 411205, 0.47024, 11.0, 0.006315, 0.0005788, 0.09025, 0.008272, 0.148,
6, 0.10495, 525.0, 411205, 0.47024, 0.0 -0.000020, 0.0001663, 0.00019, 0.001584, 0.148,
6, 0.10495, 525.0, 411205, 0.47024, 6.0, 0.003317, 0.0003300, 0.03160, 0.003145, 0.148,
6, 0.10495, 525.0, 411205, 0.47024, 6.0, 0.003127, 0.0003299, 0.02980, 0.003144, 0.148,
6, 0.10495, 525.0, 411205, 0.47024, 8.0, 0.004974, 0.0004698, 0.04739, 0.004476, 0.148,
6, 0.10495, 525.0, 411205, 0.47024, 8.0, 0.004905, 0.0004816, 0.04674, 0.004588, 0.148,
6, 0.10495, 525.0, 411205, 0.47024, 10.0, 0.007011, 0.0006860, 0.06680, 0.006536, 0.148,
6, 0.10495, 525.0, 411205, 0.47024, 10.0, 0.007010, 0.0006965, 0.06680, 0.006636, 0.148,
6, 0.10495, 525.0, 411205, 0.47024, 10.0, 0.006829, 0.0006922, 0.06507, 0.006595, 0.148,
6, 0.10495, 525.0, 411205, 0.47024, 11.0, 0.007959, 0.0008262, 0.07584, 0.007872, 0.148,
6, 0.10495, 525.0, 411205, 0.47024, 11.0, 0.008072, 0.0008359, 0.07691, 0.007965, 0.148,
8, 0.13994, 525.0, 411205, 0.47024, 0.0 -0.000037, 0.0002206 -0.00026, 0.001576, 0.148,
8, 0.13994, 525.0, 411205, 0.47024, 6.0, 0.003618, 0.0004161, 0.02585, 0.002973, 0.148,
8, 0.13994, 525.0, 411205, 0.47024, 6.0, 0.003848, 0.0004302, 0.02750, 0.003074, 0.148,
8, 0.13994, 525.0, 411205, 0.47024, 6.0, 0.004036, 0.0004399, 0.02884, 0.003143, 0.148,
8, 0.13994, 525.0, 411205, 0.47024, 8.0, 0.005843, 0.0006176, 0.04175, 0.004413, 0.148,
8, 0.13994, 525.0, 411205, 0.47024, 8.0, 0.005896, 0.0006429, 0.04213, 0.004594, 0.148,
8, 0.13994, 525.0, 411205, 0.47024, 10.0, 0.008194, 0.0008899, 0.05856, 0.006359, 0.148,
8, 0.13994, 525.0, 411205, 0.47024, 10.0, 0.008311, 0.0009068, 0.05939, 0.006480, 0.148,
8, 0.13994, 525.0, 411205, 0.47024, 11.0, 0.009620, 0.0010719, 0.06875, 0.007660, 0.148,
8, 0.13994, 525.0, 411205, 0.47024, 11.0, 0.009485, 0.0010954, 0.06778, 0.007828, 0.148,
# Landgrebe, An Analytical and Experimental Investigation of Helicopter Rotor Hover Performance and Wake Geometry Characteristics. 1971. (USAAMRDL-TR-71-24)
# Tags: hover
# -, -, -, m, m, deg, deg, deg
geometry, section, airfoil, nBlades, radial pos, chord, twist, precone, sweep
1, 1, NACA0012, 2, 0.1905, 0.1905, 0, 0.5, 0
1, 2, NACA0012, 2, 1.143 , 0.1905, 0, 0.5, 0
# miss_hit style checker
# (https://florianschanda.github.io/miss_hit/style_checker.html)
#
project_root
# Ensure copyright notice is everywhere
copyright_primary_entity: "University of Liege"
copyright_entity: "Thomas Lambert <t.lambert@uliege.be>"
# Enable miss_hit on the whole repo
enable: 1
enforce_encoding: "utf8"
# Layout
line_length: 100
tab_width: 4
# Regex to enforce naming convention
regex_script_name: "[a-z](_?[a-z0-9]+)*"
regex_function_name: "[a-z](_?[a-z0-9]+)*"
regex_nested_name: "[a-z](_?[a-z0-9]+)*"
regex_parameter_name: "[a-zA-Z](_?[a-zA-Z0-9]+)*"
regex_class_name: "[A-Z]([a-zA-Z0-9]+)*"
regex_method_name: "[a-z](_?[a-zA-Z0-9]+)*"
# metrics limit for the code quality
# (https://florianschanda.github.io/miss_hit/metrics.html)
metric "cnest": limit 5
metric "file_length": limit 800
metric "cyc": limit 15
metric "parameters": limit 10
metric "globals": limit 0
metric "persistent": limit 3
function uiucdownload(varargin)
% UIUCDOWNLOAD Download, extract and clean the UIUC propeller database.
% This function executes the following tasks:
% 1. Download the UIUC Propeller database into database/UIUC-propDB_YYYYMMDD.zip. It also
% saves the file hash into a textfile in oder to prevent useless re-downloads.
% 2. Unzip the database and moves the data files found in volumeX/data/* into
% database/UIUC_propDB/volumeX/*
% 3. The rest of the unzipped files are cleaned up
% 4. The zip file is either kept or removed, based on user input
% -----
%
% Syntax:
% uiucdownload() Download the database (if needed) and its md5 checksum, extract the data
% files and cleanup afterwards.
%
% uiucdownload('force', true) Forces the redownload of the database, even if the md5 checksum
% found locally matches the one present on the UIUC website. Default: false.
%
% uiucdownload('quiet', true) Removes all verbosity from the command line. Default: false.
%
% uiucdownload('removeZip', true) Removes the zipfile as well during cleanup. Default: true.
%
% uiucdownload('removeSum', true) Removes the checksum file as well during cleanup.
% Note that this will result in a forced download of the database if the function is run
% again, even if the zip-file is still present locally. Default: false.
%
% Inputs:
% 'force' : Forces redownload of the database
% 'quiet' : Removes verbosity from the command line
% 'removeZip' : Removes the zip-file at cleanup
% 'removeSum' : Removes the checksum at cleanup. This will force a redownload if the function
% is run again
%
% Outputs:
% UIUC-propDB : Directory containing the all useful data from the UIUC propeller database.
%
% Examples:
% uiucdownload()
% uiucdownload('force', true)
% uiucdownload('removeZip', false, 'force', true)
% -----------------------------------------
% (c) Copyright 2023 University of Liege
% Author: Thomas Lambert <t.lambert@uliege.be>
% ULiege - Aeroelasticity and Experimental Aerodynamics
% MIT License
% Repo: https://gitlab.uliege.be/rotare/rotor-db
% Issues: https://gitlab.uliege.be/rotare/rotor-db/-/issues
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all;
clc;
% Defaults and constants
PROP_DB_URL = 'https://m-selig.ae.illinois.edu/props/propDB.html';
PROP_DB_ZIP_URL = 'https://m-selig.ae.illinois.edu/props/download/UIUC-propDB.zip';
N_VOLUMES = 4; % Number of volumes in the database
DB_DIR = '../database/';
DB_NAME = 'UIUC-propDB';
ZIP_FILENAME = 'UIUC-propDB.zip';
SUM_FILENAME = 'UIUC-propDB.md5';
% Parse function options
[forceDownload, removeZip, removeSum, quiet] = parseoptions(varargin{:});
% Retreive the md5sum of the UIUC-propDB.zip
sumfilename = [DB_DIR, SUM_FILENAME];
currentSum = getcurrentchecksum(PROP_DB_URL); % Checksum from the website
oldSum = getlocalchecksum(sumfilename); % Checksum saved locally
if ~strcmp(currentSum, oldSum) || forceDownload
zipfilename = [DB_DIR, ZIP_FILENAME];
tempdir = [zipfilename, '.temp'];
dbname = [DB_DIR, DB_NAME];
% Download database and save corresponding checksum
verboseoutput(quiet, 'Downloading the database. This may take a while...\n');
websave([DB_DIR, ZIP_FILENAME], PROP_DB_ZIP_URL); % TODO UNCOMMENT AFTER TESTING
verboseoutput(quiet, 'Download completed.\n');
savetofile(sumfilename, currentSum);
% Unzip database and copy files
verboseoutput(quiet, 'Extracting database files... ');
unzip(zipfilename, tempdir);
verboseoutput(quiet, 'Done!\nCopying the database files...');
copydbfiles(tempdir, dbname, N_VOLUMES);
verboseoutput(quiet, 'Done!\n');
% Cleanup
verboseoutput(quiet, 'Cleaning up...\n');
cleanup(tempdir, zipfilename, sumfilename, removeZip, removeSum);
verboseoutput(quiet, 'All done!\n');
else
verboseoutput(quiet, ['It seems that the database has already been downloaded.\n'...
'You can force a re-download by using '...
'''uiucdownload(''force'', true)''.\n']);
end
end
% --------------------------------------------------------------------------------------------------
function [forceDownload, removeZip, removeSum, quiet] = parseoptions(varargin)
% PARSEOPTIONS Parse function optional inputs
% Defaults and constants
DEF_FORCE_DOWNLOAD = false; % Force redownload of the full DB
DEF_REMOVE_ZIP = true; % Remove the zipfile during cleanup
DEF_REMOVE_SUM = false; % Remove the checksum during cleanup (not advised)
DEF_QUIET = false; % Do not show any output
% Option validators
validLogical = @(x) validateattributes(x, {'logical'}, {'scalar'});
% Parse options
p = inputParser;
addParameter(p, 'force', DEF_FORCE_DOWNLOAD, validLogical);
addParameter(p, 'quiet', DEF_QUIET, validLogical);
addParameter(p, 'removeZip', DEF_REMOVE_ZIP, validLogical);
addParameter(p, 'removeSum', DEF_REMOVE_SUM, validLogical);
parse(p, varargin{:});
forceDownload = p.Results.force;
removeZip = p.Results.removeZip;
removeSum = p.Results.removeSum;
quiet = p.Results.quiet;
end
function checksum = getcurrentchecksum(url)
% GETCURRENTCHECKSUM Returns the file checksum found on the webpage
MD5_REGEX = '([a-fA-F\d]{32})';
% Read and parse webpage
webpage = webread(url);
parsedPage = textscan(webpage, '%s', 'delimiter', '\n');
% Get current checksum
checksumLine = parsedPage{1}(contains(parsedPage{1}(:), "md5sum"));
[md5start, md5end] = regexp(checksumLine{:}, MD5_REGEX);
checksum = checksumLine{:}(md5start:md5end);
end
function checksum = getlocalchecksum(file)
% GETLOCALCHECKSUM Retreive checksum saved locally
checksum = [];
if isfile(file)
checksum = fileread(file);
end
end
function savetofile(file, string)
% SAVETOFILE Save a string to a file
fileID = fopen(file, 'w');
fprintf(fileID, '%s', string);
fclose(fileID);
end
function copydbfiles(tempdir, dbname, nVolumes)
% COPYDBFILES Copy the (interesting) database files
for iVol = 1:nVolumes
volumeDir = [dbname, '/volume-', num2str(iVol)];
mkdir(volumeDir);
copyfile([tempdir, '/UIUC-propDB/volume-', num2str(iVol), '/data/*'], volumeDir);
end
end
function verboseoutput(quiet, string)
% VERBOSEOUTPUT Output information to the console
if ~quiet
fprintf(string);
end
end
function cleanup(tempdir, zipfilename, sumfilename, removeZip, removeSum)
% CLEANUP Clean-up directories, files, etc
% Remove the extracted archive
rmdir(tempdir, 's');
% Remove zip archive
if removeZip
delete(zipfilename);
end
% Remove checksum
if removeSum
delete(sumfilename);
end
end