Search for question
Question

1. Port Entries Package

Create three new Python modules, one for reading the dataset, one for finding ports, and one for comparing two ports. Put the three modules (util.py, find.py, and compare.py) into a package named port_entries.

1a. Data Utilities

Create a util.py module that has two methods: download_data, get_data, and parse_data.

1b. Finding Items

Create an find.py module that has two functions, port_by_state and port_by_name. Both functions should return the ports that match the given name and/or state. port_by_state should take one parameter, the state name, while port_by_name should take two parameters, the port name and the state. However, the state is optional so if the user does not provide the state, the function should search across all states.

1c. Comparison (15 pts)

Create a compare.py module that calculates comparative information between two ports for a given date. Given a port code and two date strings as parameters, the diff_dates function should return the difference in values for each measure between the two months. Given two port codes and a date string as parameters, the diff_ports function should return the difference between ports in values for each measure.

1d. Package

Make sure all three analysis modules live in a single port_entries package. Add an __init__.py file for completeness. It may contain documentation and the pass keyword.


Most Viewed Questions Of Python

Q1. Calculate capillary rise/fall in a glass tube 2 mm diameter when immersed in (a) water (b) mercury.Both the liquids are at 20°C and the surface tension values at this temperature for water and mercury are 0.072 N/m and 0.052 N/m respectively. The specific gravity of mercury is 13.6. The contact angle of water and mercury are 0° and 130° respectively.


1. A pump-around reflux is an internal reflux for a distillation column where the liquid is withdrawn from a lower tray, cooled in a heat exchanger resulting in heat recovery and then sent back to an upper tray thus reducing the amount of top reflux. In a given distillation tower, the pump-around reflux is withdrawn from the 20th tray and sent to a pump on the ground which is located 20 m below the 20th tray. The pump discharge is cooled in a heat exchanger, and then returned to the 16th tray at the tray level through a control valve. The pump discharge line (including equivalent length of all fittings, bends,etc.) is 50 m long. For a nominal flowrate of 120 m²/h, pressure drop in the cooler is 20 kPa. Assume turbulent flow conditions. Neglect suction line frictional pressure drop. Following information is available:Tray spacing: 0.5 m, Pressure drop per tray: 1 kPa, Discharge pipe diameter = 0.3 m and f (friction factor) = 0.04, Density of Liquid (assume that it is constant) = 800 kg/m³, Tower top pressure: 300 kPa, Pump curve for the pump-around reflux pump is given by: APрump(kPa)=300 – 5v^2 where v is flowrate in m³/min a. For a 50% scale up in the pump-around reflux flow, what would be the minimum discharge pressure of the pump (i.e., under the condition when the pressure drop inа.the control valve is zero)? b. What is the pressure drop in the control valve for the 50% scale up case?


.The shaft shown in the figure is machined from AISI 1040 CD steel. The shaft rotates at 1600rpm and is supported in rolling bearings at A and B. The applied forces are F1 = 2500 Ibf andF2 = 1000 lbf. Determine the minimum fatigue factor of safety based on achieving infinite life.If infinite life is not predicted, estimate the number of cycles to failure. Also check for yielding.


The cylindrical tank with hemispherical ends shown in Fig. P2.46 contains a volatile liquid and its vapor. The liquid density is 800 kg/m3,and its vapor density is negligible. The pressure in the vapor is 120 kPa (abs) and the atmospheric pressure is 101 kPa (abs).Determine: (a) the gage pressure reading on the pressure gage, and (b) the height, h, of the mercury, manometer.


Two cables are tied together at C and are loaded as shown. Knowing that P = 500 N and a =determine the tension in (a) in cable AC, (b) in cable BC.60°, N= T_{A}= 3) The tension in the cable BC is \mathrm{T}_{\mathrm{B}}=


1. Classify each of the structures as statically determinate, statically indeterminate, stable, or unstable. If indeterminate, specify the degree of indeterminacy. (22 pts.)


12-113. The position of a particle is defined by r ={4(t – sin t)i + (2t^2 – 3)j} m, where t is in seconds and the argument for the sine is in radians. Determine the speed of the particle and its normal and tangential components of acceleration when t=1 s.


A 100 ft steel tape standardized at 68 °F and supported throughout under a tension of 10 Ibs was found to be 100.2 ft long. The tape had a cross sectional area of 0.009 in? and a weight of 0.03 Ib/ft. The tape is used to measure a horizontal distance (AB) and the measured length comes out to be 300 ft. CALTRANS plans a new ramp to connect Nutwood with US57. The ramp starts from point A (on Nutwood) to C (on US57) wherein point C will be vertically above point B (a current point on Nutwood that will get buried by ramp). The must have a smooth 4% grade, thus the tape will be used fully supported. Determine the correct slope distance to be measured (i.e. length AC) if a pull of 15 Ibs is used and the temperature is 96 °F.


Problem 2: In a boat race, boat A is leading boat B by 50 m and both boats are traveling at a constant speed of 180 km/h. At t = 0, the boats accelerate at constant rates.Knowing that when B passes A, t = 8 s and va = 225 km/h,determine (a) the acceleration of A, (b) the acceleration of В.


1-90 A hydraulic lift is to be used to lift a 1900-kg weight by putting a weight of 25 kg on a piston with a diameter of 10 cm.Determine the diameter of the piston on which the weight is to be placed.